reorganized examples directory
[coq-hetmet.git] / examples / IsomorphismForCodeTypes.hs
diff --git a/examples/IsomorphismForCodeTypes.hs b/examples/IsomorphismForCodeTypes.hs
new file mode 100644 (file)
index 0000000..6e245d7
--- /dev/null
@@ -0,0 +1,12 @@
+{-# OPTIONS_GHC -XModalTypes -ddump-types -XNoMonoPatBinds #-}
+module IsomorphismForCodeTypes
+where
+
+--------------------------------------------------------------------------------
+-- Taha-Sheard "isomorphism for code types"
+
+back  :: forall a b c. (<[b]>@a -> <[c]>@a) -> <[ b->c ]>@a
+back  = \f -> <[ \x -> ~~(f <[x]>) ]>
+
+forth :: forall a b c. <[b->c]>@a -> (<[b]>@a -> <[c]>@a)
+forth = \f -> \x -> <[ ~~f ~~x ]>