Skip to content

Instantly share code, notes, and snippets.

@tim2CF
Last active May 5, 2020 11:00
Show Gist options
  • Save tim2CF/b6f7be262c4b4e7c26e60550f405c787 to your computer and use it in GitHub Desktop.
Save tim2CF/b6f7be262c4b4e7c26e60550f405c787 to your computer and use it in GitHub Desktop.
{-# LANGUAGE MultiParamTypeClasses #-}
-- Am I reinventing the wheel?
-- Is there some standard Haskell type class which is already doing similar things?
module P88LND.Isomorphism
( Isomorphism (..),
Foo (..),
)
where
class Isomorphism a b where
l2r :: a -> b
r2l :: b -> a
data Foo = Bar | Buz
instance Isomorphism Bool Foo where
l2r True = Bar
l2r False = Buz
r2l Bar = True
r2l Buz = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment