> module Types where

> import           Database.SQLite.Simple
> import           Data.Text (Text)
> import qualified Data.Text as T

Our 'scraps' are chunks of structured data with some kind of
identifying information. In this case, our identifier is an
integer, because we explicitly don't want users to have to
name new every new scrap.

> data Scrap = Scrap
>   { scIdent :: Integer
>   , scDatum :: Datum
>   } deriving (Eq, Show)

Our 'Datum' type is not unlike a JSON value, and there's a
pretty clear 

> data Datum
>   = DString Text
>   | DLink Text Text
>   | DTag Text
>   | DRef Text
>   | DList [Datum]
>   | DRec [(Text, Datum)]
>     deriving (Eq, Show)

> data ScrapType = ScrapType
>   { scrapName   :: Text
>   , scrapFields :: [Field]
>   } deriving (Eq, Show)

> data Field = Field
>   { fieldName :: Text
>   , fieldType :: FieldType
>   } deriving (Eq, Show)

> data FieldType
>   = FTString
>   | FTLink
>   | FTTag
>   | FTRef
>   | FTList FieldType
>   | FTRec [Field]
>     deriving (Eq, Show)
