1{-# language NamedFieldPuns #-}
2{-# language StandaloneKindSignatures #-}
4module Rel8.Type.Information
12import Data.Bifunctor ( first )
13import Data.Kind ( Type )
17import qualified Hasql.Decoders as Hasql
20import qualified Opaleye.Internal.HaskellDB.PrimQuery as Opaleye
23import qualified Data.Text as Text
26type TypeInformation :: Type -> Type
27data TypeInformation a = TypeInformation
28 { encode :: a -> Opaleye.PrimExpr
29 , decode :: Hasql.Value a
34mapTypeInformation :: ()
35 => (a -> b) -> (b -> a)
36 -> TypeInformation a -> TypeInformation b
37mapTypeInformation = parseTypeInformation . fmap pure
40parseTypeInformation :: ()
41 => (a -> Either String b) -> (b -> a)
42 -> TypeInformation a -> TypeInformation b
43parseTypeInformation to from TypeInformation {encode, decode, typeName} =
45 { encode = encode . from
46 , decode = Hasql.refine (first Text.pack . to) decode
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list