Pure haskell interface to MaxMind GeoIP database

Latest on Hackage:

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

BSD3 licensed by Ondrej Palkovsky

GeoIP2 - library for accessing GeoIP2 database

Build Status Hackage

GeoIP2 is a haskell binding to the MaxMind GeoIP2 database. It parses the database according to the MaxMind DB specification, version 2 of the specification is supported. The free geolite2 database can be downloaded at

See haddock documentaion for details.

{-# LANGUAGE OverloadedStrings #-}
import Data.GeoIP2
import Data.IP (IP(..))

main = do
  geodb <- openGeoDB "GeoLite2-City.mmdb"
  let ip = IPv4 ""
  print $ (findGeoData geodb "en" ip)

  let ip2 = IPv6 "2001:4800:7817:104:be76:4eff:fe04:f608"
  print $ (findGeoData geodb "en" ip2)


  • Include timezone and accuracy in location results

  • Fixed a problem with correct decoding of 28-bit offsets

  • Changed interface to normal Either String GeoResult ->

  • Removed lru
  • Switched from binary to cereal with a significant speedup ->

  • Changed bytestring-mmap to mmap
  • Add LRU caching to improve performance (10000 entries are cached) ->

  • GHC-7.10 compatibiliy
  • Add
  • List and in cabal's extra-source-files
  • add stack.yaml
Used by 1 package:
comments powered byDisqus