Safe Haskell | None |
---|---|
Language | Haskell2010 |
Exports unsafe functions.
Since: 0.1.0.0
Synopsis
- unsafeLiftR :: forall {k} (p :: k) b a. (HasCallStack, Predicate p b) => (a -> b) -> Refined p a -> Refined p b
- unsafeLiftR2 :: forall {k} (p :: k) c a b. (HasCallStack, Predicate p c) => (a -> b -> c) -> Refined p a -> Refined p b -> Refined p c
- unsafeLiftR3 :: forall {k} (p :: k) d a b c. (HasCallStack, Predicate p d) => (a -> b -> c -> d) -> Refined p a -> Refined p b -> Refined p c -> Refined p d
Documentation
unsafeLiftR :: forall {k} (p :: k) b a. (HasCallStack, Predicate p b) => (a -> b) -> Refined p a -> Refined p b Source #
Lifts a function onto Refined
, dying with an error if the
predicate is not preserved. Intended for when we know a function
preserves the refinement (e.g. addition of positive integers).
WARNING: This function is not total. Exercise restraint!
Examples
>>>
unsafeLiftR (fmap even) $$(refineTH @(SizeEqualTo 4) [2, 4, 1, 8])
Refined [True,True,False,True]
Since: 0.1.0.0
unsafeLiftR2 :: forall {k} (p :: k) c a b. (HasCallStack, Predicate p c) => (a -> b -> c) -> Refined p a -> Refined p b -> Refined p c Source #
Lifts a binary function onto Refined
, dying with an error if the
predicate is not preserved. Intended for when we know a function
preserves the refinement (e.g. addition of positive integers).
WARNING: This function is not total. Exercise restraint!
Examples
>>>
unsafeLiftR2 (+) $$(refineTH @Positive 7) $$(refineTH @Positive 11)
Refined 18
Since: 0.1.0.0
unsafeLiftR3 :: forall {k} (p :: k) d a b c. (HasCallStack, Predicate p d) => (a -> b -> c -> d) -> Refined p a -> Refined p b -> Refined p c -> Refined p d Source #
Lifts a ternary function onto Refined
, dying with an error if the
predicate is not preserved. Intended for when we know a function
preserves the refinement (e.g. addition of positive integers).
WARNING: This function is not total. Exercise restraint!
Examples
>>>
unsafeLiftR3 (\x y z -> x + y + z) $$(refineTH @Positive 1) $$(refineTH @Positive 2) $$(refineTH @Positive 3)
Refined 6
Since: 0.1.0.0