aboutsummaryrefslogtreecommitdiff
path: root/lib/PersistOrphans.hs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/PersistOrphans.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/PersistOrphans.hs b/lib/PersistOrphans.hs
index 68e9738..1f521cc 100644
--- a/lib/PersistOrphans.hs
+++ b/lib/PersistOrphans.hs
@@ -1,9 +1,9 @@
--- | This module contains instances for the Data.UUID UUID type
--- to be mapped to postgresql's custom builtin uuid type.
+-- | Instances for the Data.UUID UUID type to be mapped to postgresql's
+-- custom builtin uuid type.
--
-- Unfortunately, this breaks compatability with other SQL databases
-- (though uuids aren't really supported by most anyways)
-module PersistOrphans where
+module PersistOrphans () where
import Data.Either.Combinators (maybeToRight)
@@ -25,8 +25,10 @@ instance PersistField UUID where
maybeToRight "not a uuid (cannot decode)" $ UUID.fromASCIIBytes buf
fromPersistValue v = Left $ "not a uuid (wrong type in database): " <> T.pack (show v)
-- postgres is type-safe, so this should /hopefully/ never happen
+
instance PersistFieldSql UUID where
sqlType = const $ SqlOther "uuid"
+
instance PathPiece UUID where
fromPathPiece = UUID.fromText
toPathPiece = UUID.toText