Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class Strengthen w s | s -> w where
- strengthen :: w -> Validation (NonEmpty StrengthenError) s
- data StrengthenError
- strengthenErrorBase :: forall s w. (Typeable w, Show w, Typeable s) => w -> String -> Validation (NonEmpty StrengthenError) s
- strengthenErrorPretty :: NonEmpty StrengthenError -> Doc a
- strengthenBounded :: forall b n. (Integral b, Bounded b, Show b, Typeable b, Integral n, Show n, Typeable n) => n -> Validation (NonEmpty StrengthenError) b
Documentation
class Strengthen w s | s -> w where Source #
Any w
can be "strengthened" into an s
by asserting some properties.
For example, you may strengthen some Natural
n
into a Word8
by asserting
0 <= n <= 255
.
Note that we restrict strengthened types to having only one corresponding weak representation using functional dependencies.
strengthen :: w -> Validation (NonEmpty StrengthenError) s Source #
Instances
data StrengthenError Source #
StrengthenErrorBase String String String String | weak type, strong type, weak value, msg |
StrengthenErrorField String String String String String String StrengthenError | weak datatype name, strong datatype name, weak constructor name, strong constructor name, weak field name, strong field name, error |
Instances
Show StrengthenError Source # | |
Defined in Strongweak.Strengthen showsPrec :: Int -> StrengthenError -> ShowS # show :: StrengthenError -> String # showList :: [StrengthenError] -> ShowS # | |
Pretty StrengthenError Source # | |
Defined in Strongweak.Strengthen pretty :: StrengthenError -> Doc ann # prettyList :: [StrengthenError] -> Doc ann # |
strengthenErrorBase :: forall s w. (Typeable w, Show w, Typeable s) => w -> String -> Validation (NonEmpty StrengthenError) s Source #
strengthenBounded :: forall b n. (Integral b, Bounded b, Show b, Typeable b, Integral n, Show n, Typeable n) => n -> Validation (NonEmpty StrengthenError) b Source #