{-# OPTIONS_GHC -Wno-redundant-constraints #-}
module Refined.Extras.Unsafe
( unsafeLiftR,
unsafeLiftR2,
unsafeLiftR3,
)
where
import GHC.Stack (HasCallStack)
import Refined (Predicate, Refined)
import Refined qualified as R
import Refined.Extras.Utils (pattern MkRefined)
import Refined.Unsafe qualified as RUnsafe
unsafeLiftR ::
(HasCallStack, Predicate p b) =>
(a -> b) ->
Refined p a ->
Refined p b
unsafeLiftR :: forall {k} (p :: k) b a.
(HasCallStack, Predicate p b) =>
(a -> b) -> Refined p a -> Refined p b
unsafeLiftR a -> b
f = b -> Refined p b
forall {k} (p :: k) x. Predicate p x => x -> Refined p x
RUnsafe.unsafeRefine (b -> Refined p b)
-> (Refined p a -> b) -> Refined p a -> Refined p b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b
f (a -> b) -> (Refined p a -> a) -> Refined p a -> b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Refined p a -> a
forall {k} (p :: k) x. Refined p x -> x
R.unrefine
unsafeLiftR2 ::
(HasCallStack, Predicate p c) =>
(a -> b -> c) ->
Refined p a ->
Refined p b ->
Refined p c
unsafeLiftR2 :: forall {k} (p :: k) c a b.
(HasCallStack, Predicate p c) =>
(a -> b -> c) -> Refined p a -> Refined p b -> Refined p c
unsafeLiftR2 a -> b -> c
f (MkRefined a
x) = c -> Refined p c
forall {k} (p :: k) x. Predicate p x => x -> Refined p x
RUnsafe.unsafeRefine (c -> Refined p c)
-> (Refined p b -> c) -> Refined p b -> Refined p c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b -> c
f a
x (b -> c) -> (Refined p b -> b) -> Refined p b -> c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Refined p b -> b
forall {k} (p :: k) x. Refined p x -> x
R.unrefine
unsafeLiftR3 ::
(HasCallStack, Predicate p d) =>
(a -> b -> c -> d) ->
Refined p a ->
Refined p b ->
Refined p c ->
Refined p d
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
unsafeLiftR3 a -> b -> c -> d
f (MkRefined a
x) (MkRefined b
y) =
d -> Refined p d
forall {k} (p :: k) x. Predicate p x => x -> Refined p x
RUnsafe.unsafeRefine (d -> Refined p d)
-> (Refined p c -> d) -> Refined p c -> Refined p d
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b -> c -> d
f a
x b
y (c -> d) -> (Refined p c -> c) -> Refined p c -> d
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Refined p c -> c
forall {k} (p :: k) x. Refined p x -> x
R.unrefine