module Distribution.Types.AbiHash
( AbiHash, unAbiHash, mkAbiHash
) where
import Prelude ()
import Distribution.Compat.Prelude
import Distribution.Utils.ShortText
import qualified Distribution.Compat.ReadP as Parse
import qualified Text.PrettyPrint as Disp
import Distribution.Text
newtype AbiHash = AbiHash ShortText
deriving (Eq, Show, Read, Generic)
unAbiHash :: AbiHash -> String
unAbiHash (AbiHash h) = fromShortText h
mkAbiHash :: String -> AbiHash
mkAbiHash = AbiHash . toShortText
instance IsString AbiHash where
fromString = mkAbiHash
instance Binary AbiHash
instance Text AbiHash where
disp = Disp.text . unAbiHash
parse = fmap mkAbiHash (Parse.munch isAlphaNum)