summaryrefslogtreecommitdiff
path: root/src/Identity.hs
blob: 76d0c979775a424f802f997496de4a21d4f248e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module Identity (
    Identity(..),
) where

import Data.Text (Text)

import Storage

data Identity = Identity
    { idName :: Text
    , idPrev :: Maybe (Stored Identity)
    }
    deriving (Show)

instance Storable Identity where
    store' idt = storeRec $ do
        storeText "name" $ idName idt
        storeMbRef "prev" $ idPrev idt

    load' = loadRec $ Identity
        <$> loadText "name"
        <*> loadMbRef "prev"