We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8fbe327 commit 8472858Copy full SHA for 8472858
src/Data/Profunctor.purs
@@ -1,6 +1,7 @@
1
module Data.Profunctor where
2
3
import Prelude
4
+import Data.Newtype (class Newtype, wrap, unwrap)
5
6
-- | A `Profunctor` is a `Functor` from the pair category `(Type^op, Type)`
7
-- | to `Type`.
@@ -33,5 +34,11 @@ rmap b2c = dimap id b2c
33
34
arr :: forall a b p. (Category p, Profunctor p) => (a -> b) -> p a b
35
arr f = rmap f id
36
37
+unwrapIso :: forall p t a. (Profunctor p, Newtype t a) => p t t -> p a a
38
+unwrapIso = dimap wrap unwrap
39
+
40
+wrapIso :: forall p t a. (Profunctor p, Newtype t a) => (t -> a) -> p a a -> p t t
41
+wrapIso _ = dimap unwrap wrap
42
43
instance profunctorFn :: Profunctor (->) where
44
dimap a2b c2d b2c = a2b >>> b2c >>> c2d
0 commit comments