C3BUGSBWBKOXFFB6TIHDLQVFV65OKKW6KEUVMP4O2XP3RYMPJ5QAC
WIHPB3GXBYKWLOVPHSLFXHBCX53ZXAQ6LRJMYUQYDE4BRYV6YSMQC
SNYOEZI7JMTLJNLM2YTAHBPJEKK2BJZJDOHRIX5676JCF2VNET3QC
Y6ZRZNGIYQLPYPV5PK6PA6FWMG3RQFKRJXVMBUYMW2WQ7ZT5O5WAC
P2KQ6PRM6HH2NQFXCTQIMGTAKXIG6BQ32IBYTKBSP4NWTZ4JLGGAC
XAMFHYIWLYWVS52I3PNB7QB2YUBJQI3ORGFRTJOKW55GOFTYWRYQC
O7ZBGSRLERE2KAOQHQTO5B3MOMW5Z2JRR33GG3TBCTXIMXBRF3UQC
SCI4JXPAPVL5I2GGL2BLXXSQKAD4Z5O2RTS4UODNFVKNC262ABIAC
type Category = Refined NonEmpty Text
type CardName = Refined NonEmpty Text
import GHC.Generics (Generic)
newtype NonEmptyText = NonEmptyText {runText :: (Refined NonEmpty Text)}
deriving (Show, Eq, Ord)
type Category = NonEmptyText
type CardName = NonEmptyText
newtype PositiveNumber = PositiveNumber {runNumber :: (Refined Positive Natural)}
deriving (Show, Eq, Ord)
deriving (Show, Eq, Ord)
deriving (Show, Eq, Ord, Generic, FromRecord, ToRecord)
instance FromField NonEmptyText where
parseField s = (refineFail . decodeUtf8Lenient $ s) >>= return . NonEmptyText
instance FromField PositiveNumber where
parseField s =
maybe
mzero
(\x -> refineFail x >>= return . PositiveNumber)
(fromIntegral . fst <$> BS.readInt s)
instance ToField NonEmptyText where
toField s = error "not implemented"