From c3dfd7cb0e69b935d06a583e8aefa943c7546c36 Mon Sep 17 00:00:00 2001 From: tysonzero Date: Sat, 21 Mar 2020 04:59:40 -0400 Subject: [PATCH] Drop usage of removed Esqueleto class --- esqueleto-postgis.cabal | 4 ++-- src/Database/Esqueleto/Postgis/Geography.hs | 11 ++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/esqueleto-postgis.cabal b/esqueleto-postgis.cabal index 4a2a1cf..55e2a03 100644 --- a/esqueleto-postgis.cabal +++ b/esqueleto-postgis.cabal @@ -1,5 +1,5 @@ name: esqueleto-postgis -version: 1.2.0.0 +version: 1.3.0.0 build-type: Simple cabal-version: >=1.10 @@ -8,7 +8,7 @@ library ghc-options: -O2 -Wall default-language: Haskell2010 build-depends: base >=4.12.0 && <4.13 - , esqueleto >=2.6.0 && <2.7 + , esqueleto >=2.6.0 && <2.8 || >=3.0.0 && <3.4 , geos >=0.2.2 && <0.3 , persistent-postgis >=1.2.0 && <1.3 exposed-modules: Database.Esqueleto.Postgis.Geography diff --git a/src/Database/Esqueleto/Postgis/Geography.hs b/src/Database/Esqueleto/Postgis/Geography.hs index cc247c7..91d952b 100644 --- a/src/Database/Esqueleto/Postgis/Geography.hs +++ b/src/Database/Esqueleto/Postgis/Geography.hs @@ -2,21 +2,18 @@ module Database.Esqueleto.Postgis.Geography (intersects) where -import Database.Esqueleto (Esqueleto, SqlBackend, SqlExpr, SqlQuery, Value) +import Database.Esqueleto (SqlExpr, Value) import Database.Esqueleto.Internal.Sql (unsafeSqlFunction) import Data.Geometry.Geos.Geometry (Some) import Database.Persist.Postgis.Geography (Geography) - class IsGeography g instance IsGeography (Geography a) instance IsGeography (Some Geography) instance IsGeography a => IsGeography (Maybe a) -class Esqueleto query expr backend => EsqueletoGeography query expr backend where - intersects :: (IsGeography a, IsGeography b) - => expr (Value a) -> expr (Value b) -> expr (Value Bool) +intersects :: (IsGeography a, IsGeography b) + => SqlExpr (Value a) -> SqlExpr (Value b) -> SqlExpr (Value Bool) +intersects a b = unsafeSqlFunction "ST_Intersects" (a, b) infixl 7 `intersects` -instance EsqueletoGeography SqlQuery SqlExpr SqlBackend where - intersects a b = unsafeSqlFunction "ST_Intersects" (a, b)