{-# LANGUAGE DeriveDataTypeable, GeneralizedNewtypeDeriving, RecordWildCards, TemplateHaskell, OverloadedStrings #-}
module Clckwrks.Types
    ( UUID
    , Prefix(..)
    , Trust(..)
    , NamedLink(..)
    ) where

import Control.Applicative ((<$>))
import Data.Aeson    (ToJSON(..), (.=), object)
import Data.Data     (Data, Typeable)
import Data.SafeCopy (SafeCopy(..), base, deriveSafeCopy, safeGet, safePut, contain)
import Data.Text     (Text)
import qualified Data.Text.Encoding as T
import Data.UUID.Types (UUID)
import Data.UUID.Orphans ()
import HSP.Google.Analytics (UACCT)


-- | 'SafeCopy' instances for some 3rd party types
$(deriveSafeCopy 0 'base ''UACCT)

-- | at present this is only used by the menu editor
newtype Prefix = Prefix { Prefix -> Text
prefixText :: Text }
    deriving (Prefix -> Prefix -> Bool
(Prefix -> Prefix -> Bool)
-> (Prefix -> Prefix -> Bool) -> Eq Prefix
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Prefix -> Prefix -> Bool
$c/= :: Prefix -> Prefix -> Bool
== :: Prefix -> Prefix -> Bool
$c== :: Prefix -> Prefix -> Bool
Eq, Eq Prefix
Eq Prefix
-> (Prefix -> Prefix -> Ordering)
-> (Prefix -> Prefix -> Bool)
-> (Prefix -> Prefix -> Bool)
-> (Prefix -> Prefix -> Bool)
-> (Prefix -> Prefix -> Bool)
-> (Prefix -> Prefix -> Prefix)
-> (Prefix -> Prefix -> Prefix)
-> Ord Prefix
Prefix -> Prefix -> Bool
Prefix -> Prefix -> Ordering
Prefix -> Prefix -> Prefix
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Prefix -> Prefix -> Prefix
$cmin :: Prefix -> Prefix -> Prefix
max :: Prefix -> Prefix -> Prefix
$cmax :: Prefix -> Prefix -> Prefix
>= :: Prefix -> Prefix -> Bool
$c>= :: Prefix -> Prefix -> Bool
> :: Prefix -> Prefix -> Bool
$c> :: Prefix -> Prefix -> Bool
<= :: Prefix -> Prefix -> Bool
$c<= :: Prefix -> Prefix -> Bool
< :: Prefix -> Prefix -> Bool
$c< :: Prefix -> Prefix -> Bool
compare :: Prefix -> Prefix -> Ordering
$ccompare :: Prefix -> Prefix -> Ordering
$cp1Ord :: Eq Prefix
Ord, ReadPrec [Prefix]
ReadPrec Prefix
Int -> ReadS Prefix
ReadS [Prefix]
(Int -> ReadS Prefix)
-> ReadS [Prefix]
-> ReadPrec Prefix
-> ReadPrec [Prefix]
-> Read Prefix
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Prefix]
$creadListPrec :: ReadPrec [Prefix]
readPrec :: ReadPrec Prefix
$creadPrec :: ReadPrec Prefix
readList :: ReadS [Prefix]
$creadList :: ReadS [Prefix]
readsPrec :: Int -> ReadS Prefix
$creadsPrec :: Int -> ReadS Prefix
Read, Int -> Prefix -> ShowS
[Prefix] -> ShowS
Prefix -> String
(Int -> Prefix -> ShowS)
-> (Prefix -> String) -> ([Prefix] -> ShowS) -> Show Prefix
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Prefix] -> ShowS
$cshowList :: [Prefix] -> ShowS
show :: Prefix -> String
$cshow :: Prefix -> String
showsPrec :: Int -> Prefix -> ShowS
$cshowsPrec :: Int -> Prefix -> ShowS
Show, Typeable Prefix
DataType
Constr
Typeable Prefix
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Prefix -> c Prefix)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Prefix)
-> (Prefix -> Constr)
-> (Prefix -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Prefix))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Prefix))
-> ((forall b. Data b => b -> b) -> Prefix -> Prefix)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Prefix -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Prefix -> r)
-> (forall u. (forall d. Data d => d -> u) -> Prefix -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Prefix -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Prefix -> m Prefix)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Prefix -> m Prefix)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Prefix -> m Prefix)
-> Data Prefix
Prefix -> DataType
Prefix -> Constr
(forall b. Data b => b -> b) -> Prefix -> Prefix
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Prefix -> c Prefix
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Prefix
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Prefix -> u
forall u. (forall d. Data d => d -> u) -> Prefix -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Prefix -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Prefix -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Prefix -> m Prefix
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Prefix -> m Prefix
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Prefix
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Prefix -> c Prefix
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Prefix)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Prefix)
$cPrefix :: Constr
$tPrefix :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Prefix -> m Prefix
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Prefix -> m Prefix
gmapMp :: (forall d. Data d => d -> m d) -> Prefix -> m Prefix
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Prefix -> m Prefix
gmapM :: (forall d. Data d => d -> m d) -> Prefix -> m Prefix
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Prefix -> m Prefix
gmapQi :: Int -> (forall d. Data d => d -> u) -> Prefix -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Prefix -> u
gmapQ :: (forall d. Data d => d -> u) -> Prefix -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Prefix -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Prefix -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Prefix -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Prefix -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Prefix -> r
gmapT :: (forall b. Data b => b -> b) -> Prefix -> Prefix
$cgmapT :: (forall b. Data b => b -> b) -> Prefix -> Prefix
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Prefix)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Prefix)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Prefix)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Prefix)
dataTypeOf :: Prefix -> DataType
$cdataTypeOf :: Prefix -> DataType
toConstr :: Prefix -> Constr
$ctoConstr :: Prefix -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Prefix
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Prefix
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Prefix -> c Prefix
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Prefix -> c Prefix
$cp1Data :: Typeable Prefix
Data, Typeable)

instance SafeCopy Prefix where
    kind :: Kind Prefix
kind = Kind Prefix
forall a. Kind a
base
    getCopy :: Contained (Get Prefix)
getCopy = Get Prefix -> Contained (Get Prefix)
forall a. a -> Contained a
contain (Get Prefix -> Contained (Get Prefix))
-> Get Prefix -> Contained (Get Prefix)
forall a b. (a -> b) -> a -> b
$ (Text -> Prefix
Prefix (Text -> Prefix) -> (ByteString -> Text) -> ByteString -> Prefix
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Text
T.decodeUtf8) (ByteString -> Prefix) -> Get ByteString -> Get Prefix
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get ByteString
forall a. SafeCopy a => Get a
safeGet
    putCopy :: Prefix -> Contained Put
putCopy = Put -> Contained Put
forall a. a -> Contained a
contain (Put -> Contained Put)
-> (Prefix -> Put) -> Prefix -> Contained Put
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Put
forall a. SafeCopy a => a -> Put
safePut (ByteString -> Put) -> (Prefix -> ByteString) -> Prefix -> Put
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> ByteString
T.encodeUtf8 (Text -> ByteString) -> (Prefix -> Text) -> Prefix -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Prefix -> Text
prefixText
    errorTypeName :: Proxy Prefix -> String
errorTypeName Proxy Prefix
_ = String
"Prefix"

data Trust
    = Trusted   -- ^ used when the author can be trusted     (sanitization is not performed)
    | Untrusted -- ^ used when the author can not be trusted (sanitization is performed)
      deriving (Trust -> Trust -> Bool
(Trust -> Trust -> Bool) -> (Trust -> Trust -> Bool) -> Eq Trust
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Trust -> Trust -> Bool
$c/= :: Trust -> Trust -> Bool
== :: Trust -> Trust -> Bool
$c== :: Trust -> Trust -> Bool
Eq, Eq Trust
Eq Trust
-> (Trust -> Trust -> Ordering)
-> (Trust -> Trust -> Bool)
-> (Trust -> Trust -> Bool)
-> (Trust -> Trust -> Bool)
-> (Trust -> Trust -> Bool)
-> (Trust -> Trust -> Trust)
-> (Trust -> Trust -> Trust)
-> Ord Trust
Trust -> Trust -> Bool
Trust -> Trust -> Ordering
Trust -> Trust -> Trust
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Trust -> Trust -> Trust
$cmin :: Trust -> Trust -> Trust
max :: Trust -> Trust -> Trust
$cmax :: Trust -> Trust -> Trust
>= :: Trust -> Trust -> Bool
$c>= :: Trust -> Trust -> Bool
> :: Trust -> Trust -> Bool
$c> :: Trust -> Trust -> Bool
<= :: Trust -> Trust -> Bool
$c<= :: Trust -> Trust -> Bool
< :: Trust -> Trust -> Bool
$c< :: Trust -> Trust -> Bool
compare :: Trust -> Trust -> Ordering
$ccompare :: Trust -> Trust -> Ordering
$cp1Ord :: Eq Trust
Ord, ReadPrec [Trust]
ReadPrec Trust
Int -> ReadS Trust
ReadS [Trust]
(Int -> ReadS Trust)
-> ReadS [Trust]
-> ReadPrec Trust
-> ReadPrec [Trust]
-> Read Trust
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Trust]
$creadListPrec :: ReadPrec [Trust]
readPrec :: ReadPrec Trust
$creadPrec :: ReadPrec Trust
readList :: ReadS [Trust]
$creadList :: ReadS [Trust]
readsPrec :: Int -> ReadS Trust
$creadsPrec :: Int -> ReadS Trust
Read, Int -> Trust -> ShowS
[Trust] -> ShowS
Trust -> String
(Int -> Trust -> ShowS)
-> (Trust -> String) -> ([Trust] -> ShowS) -> Show Trust
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Trust] -> ShowS
$cshowList :: [Trust] -> ShowS
show :: Trust -> String
$cshow :: Trust -> String
showsPrec :: Int -> Trust -> ShowS
$cshowsPrec :: Int -> Trust -> ShowS
Show, Typeable Trust
DataType
Constr
Typeable Trust
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Trust -> c Trust)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Trust)
-> (Trust -> Constr)
-> (Trust -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Trust))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Trust))
-> ((forall b. Data b => b -> b) -> Trust -> Trust)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Trust -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Trust -> r)
-> (forall u. (forall d. Data d => d -> u) -> Trust -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Trust -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Trust -> m Trust)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Trust -> m Trust)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Trust -> m Trust)
-> Data Trust
Trust -> DataType
Trust -> Constr
(forall b. Data b => b -> b) -> Trust -> Trust
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Trust -> c Trust
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Trust
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Trust -> u
forall u. (forall d. Data d => d -> u) -> Trust -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Trust -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Trust -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Trust -> m Trust
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Trust -> m Trust
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Trust
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Trust -> c Trust
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Trust)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Trust)
$cUntrusted :: Constr
$cTrusted :: Constr
$tTrust :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Trust -> m Trust
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Trust -> m Trust
gmapMp :: (forall d. Data d => d -> m d) -> Trust -> m Trust
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Trust -> m Trust
gmapM :: (forall d. Data d => d -> m d) -> Trust -> m Trust
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Trust -> m Trust
gmapQi :: Int -> (forall d. Data d => d -> u) -> Trust -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Trust -> u
gmapQ :: (forall d. Data d => d -> u) -> Trust -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Trust -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Trust -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Trust -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Trust -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Trust -> r
gmapT :: (forall b. Data b => b -> b) -> Trust -> Trust
$cgmapT :: (forall b. Data b => b -> b) -> Trust -> Trust
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Trust)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Trust)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Trust)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Trust)
dataTypeOf :: Trust -> DataType
$cdataTypeOf :: Trust -> DataType
toConstr :: Trust -> Constr
$ctoConstr :: Trust -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Trust
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Trust
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Trust -> c Trust
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Trust -> c Trust
$cp1Data :: Typeable Trust
Data, Typeable)
$(deriveSafeCopy 0 'base ''Trust)

data NamedLink = NamedLink
    { NamedLink -> Text
namedLinkTitle :: Text
    , NamedLink -> Text
namedLinkURL   :: Text
    }
    deriving (NamedLink -> NamedLink -> Bool
(NamedLink -> NamedLink -> Bool)
-> (NamedLink -> NamedLink -> Bool) -> Eq NamedLink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NamedLink -> NamedLink -> Bool
$c/= :: NamedLink -> NamedLink -> Bool
== :: NamedLink -> NamedLink -> Bool
$c== :: NamedLink -> NamedLink -> Bool
Eq, ReadPrec [NamedLink]
ReadPrec NamedLink
Int -> ReadS NamedLink
ReadS [NamedLink]
(Int -> ReadS NamedLink)
-> ReadS [NamedLink]
-> ReadPrec NamedLink
-> ReadPrec [NamedLink]
-> Read NamedLink
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NamedLink]
$creadListPrec :: ReadPrec [NamedLink]
readPrec :: ReadPrec NamedLink
$creadPrec :: ReadPrec NamedLink
readList :: ReadS [NamedLink]
$creadList :: ReadS [NamedLink]
readsPrec :: Int -> ReadS NamedLink
$creadsPrec :: Int -> ReadS NamedLink
Read, Int -> NamedLink -> ShowS
[NamedLink] -> ShowS
NamedLink -> String
(Int -> NamedLink -> ShowS)
-> (NamedLink -> String)
-> ([NamedLink] -> ShowS)
-> Show NamedLink
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NamedLink] -> ShowS
$cshowList :: [NamedLink] -> ShowS
show :: NamedLink -> String
$cshow :: NamedLink -> String
showsPrec :: Int -> NamedLink -> ShowS
$cshowsPrec :: Int -> NamedLink -> ShowS
Show, Typeable NamedLink
DataType
Constr
Typeable NamedLink
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> NamedLink -> c NamedLink)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c NamedLink)
-> (NamedLink -> Constr)
-> (NamedLink -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c NamedLink))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NamedLink))
-> ((forall b. Data b => b -> b) -> NamedLink -> NamedLink)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> NamedLink -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> NamedLink -> r)
-> (forall u. (forall d. Data d => d -> u) -> NamedLink -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> NamedLink -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> NamedLink -> m NamedLink)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NamedLink -> m NamedLink)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> NamedLink -> m NamedLink)
-> Data NamedLink
NamedLink -> DataType
NamedLink -> Constr
(forall b. Data b => b -> b) -> NamedLink -> NamedLink
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NamedLink -> c NamedLink
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NamedLink
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> NamedLink -> u
forall u. (forall d. Data d => d -> u) -> NamedLink -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NamedLink -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NamedLink -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NamedLink -> m NamedLink
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NamedLink -> m NamedLink
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NamedLink
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NamedLink -> c NamedLink
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NamedLink)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NamedLink)
$cNamedLink :: Constr
$tNamedLink :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> NamedLink -> m NamedLink
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NamedLink -> m NamedLink
gmapMp :: (forall d. Data d => d -> m d) -> NamedLink -> m NamedLink
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NamedLink -> m NamedLink
gmapM :: (forall d. Data d => d -> m d) -> NamedLink -> m NamedLink
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NamedLink -> m NamedLink
gmapQi :: Int -> (forall d. Data d => d -> u) -> NamedLink -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> NamedLink -> u
gmapQ :: (forall d. Data d => d -> u) -> NamedLink -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> NamedLink -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NamedLink -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NamedLink -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NamedLink -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NamedLink -> r
gmapT :: (forall b. Data b => b -> b) -> NamedLink -> NamedLink
$cgmapT :: (forall b. Data b => b -> b) -> NamedLink -> NamedLink
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NamedLink)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NamedLink)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c NamedLink)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NamedLink)
dataTypeOf :: NamedLink -> DataType
$cdataTypeOf :: NamedLink -> DataType
toConstr :: NamedLink -> Constr
$ctoConstr :: NamedLink -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NamedLink
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NamedLink
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NamedLink -> c NamedLink
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NamedLink -> c NamedLink
$cp1Data :: Typeable NamedLink
Data, Typeable)
$(deriveSafeCopy 1 'base ''NamedLink)

instance ToJSON NamedLink where
    toJSON :: NamedLink -> Value
toJSON (NamedLink{Text
namedLinkURL :: Text
namedLinkTitle :: Text
namedLinkURL :: NamedLink -> Text
namedLinkTitle :: NamedLink -> Text
..}) =
        [Pair] -> Value
object [ Text
"navBarItemName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
namedLinkTitle
               , Text
"navBarItemLink" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
namedLinkURL
               ]