summaryrefslogtreecommitdiff
path: root/src/Data/Connection/Optic.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Connection/Optic.hs')
-rw-r--r--src/Data/Connection/Optic.hs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Data/Connection/Optic.hs b/src/Data/Connection/Optic.hs
new file mode 100644
index 0000000..73baee1
--- /dev/null
+++ b/src/Data/Connection/Optic.hs
@@ -0,0 +1,25 @@
+module Data.Connection.Optic (
+ dual
+ , just
+ , binord
+ , ordbin
+ , connected
+) where
+
+import Data.Connection (Conn)
+import Data.Prd
+import Data.Profunctor.Optic.Grate
+import Data.Profunctor.Optic.Import
+import qualified Data.Connection as C
+
+dual :: Prd a => Prd b => Conn a b -> Grate' (Down b) (Down a)
+dual = connected . C.dual
+
+just :: Prd a => Prd b => Conn a b -> Grate' (Maybe a) (Maybe b)
+just = connected . C.just
+
+ordbin :: Grate' Ordering Bool
+ordbin = connected C.ordbin
+
+binord :: Grate' Bool Ordering
+binord = connected C.binord