summaryrefslogtreecommitdiff
path: root/Types/TrustLevel.hs
blob: 058ce4595c6a8cffb980b9d022468623a652c76e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{- git-annex trust levels
 -
 - Copyright 2010 Joey Hess <joey@kitenet.net>
 -
 - Licensed under the GNU GPL version 3 or higher.
 -}

module Types.TrustLevel (
	TrustLevel(..),
	TrustMap
) where

import qualified Data.Map as M

import Types.UUID

data TrustLevel = SemiTrusted | UnTrusted | Trusted
	deriving Eq

instance Show TrustLevel where
        show SemiTrusted = "?"
        show UnTrusted = "0"
        show Trusted = "1"

instance Read TrustLevel where
        readsPrec _ "1" = [(Trusted, "")]
        readsPrec _ "0" = [(UnTrusted, "")]
	readsPrec _ _ = [(SemiTrusted, "")]

type TrustMap = M.Map UUID TrustLevel