1module Rel8.Type.ReadShow ( ReadShow(..) ) where
5import Text.Read ( readEither )
8import Rel8.Type ( DBType( typeInformation ) )
9import Rel8.Type.Information ( parseTypeInformation )
12import qualified Data.Text as Text
15-- | A deriving-via helper type for column types that store a Haskell value
16-- using a Haskell's 'Read' and 'Show' type classes.
21-- data Color = Red | Green | Blue
22-- deriving (Read, Show)
23-- deriving PrimitiveType via ReadShow Color
26-- will allow you to store @Color@ values in a single SQL column (stored as
28newtype ReadShow a = ReadShow { fromReadShow :: a }
31instance (Read a, Show a) => DBType (ReadShow a) where
32 typeInformation = parseTypeInformation parser printer typeInformation
34 parser = fmap ReadShow . readEither . Text.unpack
35 printer = Text.pack . show . fromReadShow
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