Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class Strengthen w s | s -> w where
- strengthen :: w -> Validation (NonEmpty StrengthenError) s
- strengthen' :: forall s w. Strengthen w s => w -> Validation (NonEmpty StrengthenError) s
- data StrengthenError
- strengthenErrorPretty :: NonEmpty StrengthenError -> Doc a
- strengthenErrorBase :: forall s w. (Typeable w, Show w, Typeable s) => w -> String -> Validation (NonEmpty StrengthenError) s
- 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
strengthen' :: forall s w. Strengthen w s => w -> Validation (NonEmpty StrengthenError) s Source #
strengthen
with reordered type variables for more convenient visible type
application.
data StrengthenError Source #
Strengthen error data type. Don't use these constructors directly, use the existing helper functions.
Field indices are from 0 in the respective constructor. Field names are provided if present.
Instances
Show StrengthenError Source # | |
Defined in Strongweak.Strengthen showsPrec :: Int -> StrengthenError -> ShowS # show :: StrengthenError -> String # showList :: [StrengthenError] -> ShowS # | |
Eq StrengthenError Source # | |
Defined in Strongweak.Strengthen (==) :: StrengthenError -> StrengthenError -> Bool # (/=) :: StrengthenError -> StrengthenError -> Bool # | |
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 #