Created
July 8, 2018 01:20
-
-
Save caasi/bfc2cba0a2706c315a07751e22808197 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Data.Functor.Constant | |
import Data.Bifunctor | |
data Riap b a = Riap a b | |
-- data PreList a b | |
-- = Nil | |
-- | PreList a b | |
newtype PreList a b = PreList (Either (Constant () a) (Riap b a)) | |
instance Functor f => Functor (Riap (f b)) where | |
fmap f (Riap a b) = Riap (f a) (fmap f b) | |
instance Bifunctor PreList where | |
bimap f g (PreList (Left c)) = PreList (Left (fmap f c)) | |
bimap f g (PreList (Right op)) = PreList (Right (fmap g op)) | |
main :: IO () | |
main = undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
更正,
PreList a b
不用是個Functor
: