newtype NonEmptyText = NonEmptyText {runText :: Refined NonEmpty Text}
newtype PositiveNumber = PositiveNumber {runNumber :: Refined Positive Natural}
parseField s = NonEmptyText <$> (refineFail . decodeUtf8Lenient $ s)
parseField s =
maybe
mzero
((fmap PositiveNumber . refineFail) . fromIntegral . fst)
(BS.readInt s)
toField = toField . unrefine . runText
toField = toField . unrefine . runNumber
unrefine . runText
fromIntegral . unrefine . runNumber
PositiveNumber . unsafeRefine $ toNumber a + toNumber b