ip2location-io-1.0.0: IP2Location.io Haskell package for IP geolocation and domain WHOIS.
Copyright(c) IP2Location 2025
LicenseMIT
Maintainersales@ip2location.com
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

IPGeolocation

Description

This module allows users to query an IP address to get geolocation & proxy info.

IP2Location.io API subscription at https://www.ip2location.io

Synopsis

Documentation

data IPResult Source #

Define the wrapper type for Response or Error

Instances

Instances details
FromJSON IPResult Source # 
Instance details

Defined in IPGeolocation

Generic IPResult Source # 
Instance details

Defined in IPGeolocation

Associated Types

type Rep IPResult :: Type -> Type #

Methods

from :: IPResult -> Rep IPResult x #

to :: Rep IPResult x -> IPResult #

Show IPResult Source # 
Instance details

Defined in IPGeolocation

type Rep IPResult Source # 
Instance details

Defined in IPGeolocation

type Rep IPResult = D1 ('MetaData "IPResult" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "IPResponse" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ResponseObj)) :+: C1 ('MetaCons "IPError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ErrorObj)))

data ResponseObj Source #

Main response type

Instances

Instances details
FromJSON ResponseObj Source # 
Instance details

Defined in IPGeolocation

Generic ResponseObj Source # 
Instance details

Defined in IPGeolocation

Associated Types

type Rep ResponseObj :: Type -> Type #

Show ResponseObj Source # 
Instance details

Defined in IPGeolocation

type Rep ResponseObj Source # 
Instance details

Defined in IPGeolocation

type Rep ResponseObj = D1 ('MetaData "ResponseObj" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "ResponseObj" 'PrefixI 'True) (((((S1 ('MetaSel ('Just "ip") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "country_code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :*: (S1 ('MetaSel ('Just "country_name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "region_name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))) :*: ((S1 ('MetaSel ('Just "city_name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "latitude") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Float)) :*: (S1 ('MetaSel ('Just "longitude") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Float) :*: (S1 ('MetaSel ('Just "zip_code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "time_zone") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))))) :*: (((S1 ('MetaSel ('Just "asn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "as") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :*: (S1 ('MetaSel ('Just "isp") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)) :*: S1 ('MetaSel ('Just "domain") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)))) :*: ((S1 ('MetaSel ('Just "net_speed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)) :*: S1 ('MetaSel ('Just "idd_code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String))) :*: (S1 ('MetaSel ('Just "area_code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)) :*: (S1 ('MetaSel ('Just "weather_station_code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)) :*: S1 ('MetaSel ('Just "weather_station_name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String))))))) :*: ((((S1 ('MetaSel ('Just "mcc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)) :*: S1 ('MetaSel ('Just "mnc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String))) :*: (S1 ('MetaSel ('Just "mobile_brand") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)) :*: S1 ('MetaSel ('Just "elevation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Int)))) :*: ((S1 ('MetaSel ('Just "usage_type") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)) :*: S1 ('MetaSel ('Just "address_type") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String))) :*: (S1 ('MetaSel ('Just "continent") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Continent)) :*: (S1 ('MetaSel ('Just "country") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Country)) :*: S1 ('MetaSel ('Just "region") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Region)))))) :*: (((S1 ('MetaSel ('Just "city") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe City)) :*: S1 ('MetaSel ('Just "time_zone_info") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe TimeZoneInfo))) :*: (S1 ('MetaSel ('Just "geotargeting") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe GeoTargeting)) :*: S1 ('MetaSel ('Just "ads_category") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)))) :*: ((S1 ('MetaSel ('Just "ads_category_name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)) :*: S1 ('MetaSel ('Just "district") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String))) :*: (S1 ('MetaSel ('Just "is_proxy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: (S1 ('MetaSel ('Just "fraud_score") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Int)) :*: S1 ('MetaSel ('Just "proxy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe ProxyObj)))))))))

data ErrorObj Source #

Define the error structure

Constructors

ErrorObj 

Fields

Instances

Instances details
FromJSON ErrorObj Source # 
Instance details

Defined in IPGeolocation

Generic ErrorObj Source # 
Instance details

Defined in IPGeolocation

Associated Types

type Rep ErrorObj :: Type -> Type #

Methods

from :: ErrorObj -> Rep ErrorObj x #

to :: Rep ErrorObj x -> ErrorObj #

Show ErrorObj Source # 
Instance details

Defined in IPGeolocation

type Rep ErrorObj Source # 
Instance details

Defined in IPGeolocation

type Rep ErrorObj = D1 ('MetaData "ErrorObj" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "ErrorObj" 'PrefixI 'True) (S1 ('MetaSel ('Just "error") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ErrorInfo)))

data ErrorInfo Source #

Define the error detail structure

Constructors

ErrorInfo 

Instances

Instances details
FromJSON ErrorInfo Source # 
Instance details

Defined in IPGeolocation

Generic ErrorInfo Source # 
Instance details

Defined in IPGeolocation

Associated Types

type Rep ErrorInfo :: Type -> Type #

Show ErrorInfo Source # 
Instance details

Defined in IPGeolocation

type Rep ErrorInfo Source # 
Instance details

Defined in IPGeolocation

type Rep ErrorInfo = D1 ('MetaData "ErrorInfo" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "ErrorInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "error_code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "error_message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))

data Continent Source #

Continent

Constructors

Continent 

Instances

Instances details
FromJSON Continent Source # 
Instance details

Defined in IPGeolocation

Generic Continent Source # 
Instance details

Defined in IPGeolocation

Associated Types

type Rep Continent :: Type -> Type #

Show Continent Source # 
Instance details

Defined in IPGeolocation

type Rep Continent Source # 
Instance details

Defined in IPGeolocation

type Rep Continent = D1 ('MetaData "Continent" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "Continent" 'PrefixI 'True) ((S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :*: (S1 ('MetaSel ('Just "hemisphere") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [String]) :*: S1 ('MetaSel ('Just "translation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Translation))))

data Translation Source #

Translation

Constructors

Translation 

Instances

Instances details
FromJSON Translation Source # 
Instance details

Defined in IPGeolocation

Generic Translation Source # 
Instance details

Defined in IPGeolocation

Associated Types

type Rep Translation :: Type -> Type #

Show Translation Source # 
Instance details

Defined in IPGeolocation

type Rep Translation Source # 
Instance details

Defined in IPGeolocation

type Rep Translation = D1 ('MetaData "Translation" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "Translation" 'PrefixI 'True) (S1 ('MetaSel ('Just "lang") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String)) :*: S1 ('MetaSel ('Just "value") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String))))

data Country Source #

Country

Instances

Instances details
FromJSON Country Source # 
Instance details

Defined in IPGeolocation

Generic Country Source # 
Instance details

Defined in IPGeolocation

Associated Types

type Rep Country :: Type -> Type #

Methods

from :: Country -> Rep Country x #

to :: Rep Country x -> Country #

Show Country Source # 
Instance details

Defined in IPGeolocation

type Rep Country Source # 
Instance details

Defined in IPGeolocation

data Currency Source #

Currency

Constructors

Currency 

Fields

Instances

Instances details
FromJSON Currency Source # 
Instance details

Defined in IPGeolocation

Generic Currency Source # 
Instance details

Defined in IPGeolocation

Associated Types

type Rep Currency :: Type -> Type #

Methods

from :: Currency -> Rep Currency x #

to :: Rep Currency x -> Currency #

Show Currency Source # 
Instance details

Defined in IPGeolocation

type Rep Currency Source # 
Instance details

Defined in IPGeolocation

type Rep Currency = D1 ('MetaData "Currency" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "Currency" 'PrefixI 'True) (S1 ('MetaSel ('Just "code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "symbol") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))))

data Language Source #

Language

Constructors

Language 

Fields

Instances

Instances details
FromJSON Language Source # 
Instance details

Defined in IPGeolocation

Generic Language Source # 
Instance details

Defined in IPGeolocation

Associated Types

type Rep Language :: Type -> Type #

Methods

from :: Language -> Rep Language x #

to :: Rep Language x -> Language #

Show Language Source # 
Instance details

Defined in IPGeolocation

type Rep Language Source # 
Instance details

Defined in IPGeolocation

type Rep Language = D1 ('MetaData "Language" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "Language" 'PrefixI 'True) (S1 ('MetaSel ('Just "code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))

data Region Source #

Region

Constructors

Region 

Instances

Instances details
FromJSON Region Source # 
Instance details

Defined in IPGeolocation

Generic Region Source # 
Instance details

Defined in IPGeolocation

Associated Types

type Rep Region :: Type -> Type #

Methods

from :: Region -> Rep Region x #

to :: Rep Region x -> Region #

Show Region Source # 
Instance details

Defined in IPGeolocation

type Rep Region Source # 
Instance details

Defined in IPGeolocation

type Rep Region = D1 ('MetaData "Region" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "Region" 'PrefixI 'True) (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: (S1 ('MetaSel ('Just "code") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "translation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Translation))))

data City Source #

City

Constructors

City 

Instances

Instances details
FromJSON City Source # 
Instance details

Defined in IPGeolocation

Generic City Source # 
Instance details

Defined in IPGeolocation

Associated Types

type Rep City :: Type -> Type #

Methods

from :: City -> Rep City x #

to :: Rep City x -> City #

Show City Source # 
Instance details

Defined in IPGeolocation

Methods

showsPrec :: Int -> City -> ShowS #

show :: City -> String #

showList :: [City] -> ShowS #

type Rep City Source # 
Instance details

Defined in IPGeolocation

type Rep City = D1 ('MetaData "City" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "City" 'PrefixI 'True) (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "translation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Translation)))

data TimeZoneInfo Source #

Time zone info

Instances

Instances details
FromJSON TimeZoneInfo Source # 
Instance details

Defined in IPGeolocation

Generic TimeZoneInfo Source # 
Instance details

Defined in IPGeolocation

Associated Types

type Rep TimeZoneInfo :: Type -> Type #

Show TimeZoneInfo Source # 
Instance details

Defined in IPGeolocation

type Rep TimeZoneInfo Source # 
Instance details

Defined in IPGeolocation

data GeoTargeting Source #

Geotargeting

Constructors

GeoTargeting 

Fields

Instances

Instances details
FromJSON GeoTargeting Source # 
Instance details

Defined in IPGeolocation

Generic GeoTargeting Source # 
Instance details

Defined in IPGeolocation

Associated Types

type Rep GeoTargeting :: Type -> Type #

Show GeoTargeting Source # 
Instance details

Defined in IPGeolocation

type Rep GeoTargeting Source # 
Instance details

Defined in IPGeolocation

type Rep GeoTargeting = D1 ('MetaData "GeoTargeting" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "GeoTargeting" 'PrefixI 'True) (S1 ('MetaSel ('Just "metro") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String))))

data ProxyObj Source #

Proxy

Instances

Instances details
FromJSON ProxyObj Source # 
Instance details

Defined in IPGeolocation

Generic ProxyObj Source # 
Instance details

Defined in IPGeolocation

Associated Types

type Rep ProxyObj :: Type -> Type #

Methods

from :: ProxyObj -> Rep ProxyObj x #

to :: Rep ProxyObj x -> ProxyObj #

Show ProxyObj Source # 
Instance details

Defined in IPGeolocation

type Rep ProxyObj Source # 
Instance details

Defined in IPGeolocation

type Rep ProxyObj = D1 ('MetaData "ProxyObj" "IPGeolocation" "ip2location-io-1.0.0-Hgie9EkdrkXKYPKWX6T2xv" 'False) (C1 ('MetaCons "ProxyObj" 'PrefixI 'True) ((((S1 ('MetaSel ('Just "last_seen") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "proxy_type") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :*: (S1 ('MetaSel ('Just "threat") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "provider") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))) :*: ((S1 ('MetaSel ('Just "is_vpn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "is_tor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "is_data_center") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "is_public_proxy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))) :*: (((S1 ('MetaSel ('Just "is_web_proxy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "is_web_crawler") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "is_residential_proxy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "is_consumer_privacy_network") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "is_enterprise_private_network") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "is_spammer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "is_scanner") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "is_botnet") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))))))

lookUpIP :: Config -> String -> String -> IO IPResult Source #

The lookUpIP function returns an IPResult containing geolocation & proxy data for an IP address It takes 3 arguments; the API configuration, either IPv4 or IPv6 address (String), lang