@@ -29,7 +29,6 @@ import Control.Monad.Trans.Either
2929import qualified Database.Persist.Types as DPT
3030import qualified Data.Set as S
3131import qualified Data.Conduit.List as CL
32−import Data.Typeable (cast)
3332import ProjectM36.RelationalExpression (unsafeCast)
3433
3534type ProjectM36Backend = C.Connection
@@ -74,11 +73,11 @@ persistValueAtom val = case val of
7473 _ -> Nothing
7574
7675atomAsPersistValue :: Atom -> PersistValue
77−atomAsPersistValue atom = case atomTypeForAtom atom of
78− stringAtomType -> PersistText (unsafeCast atom)
79− intAtomType -> PersistInt64 (fromIntegral ((unsafeCast atom)::Int))
80− boolAtomType -> PersistBool (unsafeCast atom)
81− dateAtomType -> PersistDay (unsafeCast atom)
76+atomAsPersistValue (Atom atom) = map (cast atom) (PersistText, PersistInt64, PersistBool, PersistDay)
77+ atom -> PersistText (unsafeCast atom)
78+ atom -> PersistInt64 (fromIntegral ((unsafeCast atom)::Int))
79+ atom -> PersistBool (unsafeCast atom)
80+ atom -> PersistDay (unsafeCast atom)
8281 _ -> error "missing conversion"
8382
8483recordAsAtoms :: forall record. (PersistEntity record, PersistEntityBackend record ~ C.Connection)