This file contains 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
{-# LANGUAGE GADTs, MultiParamTypeClasses, ScopedTypeVariables #-} | |
module Main where | |
import System.IO | |
import Control.Monad.Operational.Simple | |
data FileIO a where | |
Open :: FilePath -> FileIO Handle | |
Get :: Handle -> FileIO String | |
Echo :: String -> FileIO () | |
Close :: Handle -> FileIO String |
This file contains 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
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE TypeFamilies #-} | |
import GHC.Prim (Constraint) | |
import qualified Data.Set as S | |
import qualified Data.Array.Unboxed as UA | |
-------------------------------------------------------------------------------- | |
-- RFunctor |
This file contains 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
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
module Main where | |
import Control.Monad.Writer | |
import Control.Applicative | |
main :: IO () | |
main = do | |
(_, w) <- return $ makeClass $ \b -> do | |
field "foo" 42 |
This file contains 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
import Control.Comonad.Env | |
data Bin a = Node a (Bin a) (Bin a) | Leaf a | |
deriving Show | |
bintree_ex :: Bin Int | |
bintree_ex = Node 5 (Leaf 3) (Node 8 (Leaf 7) (Leaf 10)) |