Skip to content

Instantly share code, notes, and snippets.

ruicc ruicc

Block or report user

Report or block ruicc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ruicc / SearchTreeWithComonad.hs
Last active Aug 29, 2015
An Env Comonad example
View SearchTreeWithComonad.hs
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))
ruicc / MakeClass.hs
Created May 25, 2014
Writer Monad to make classes.
View MakeClass.hs
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Main where
import Control.Monad.Writer
import Control.Applicative
main :: IO ()
main = do
(_, w) <- return $ makeClass $ \b -> do
field "foo" 42
View set_is_functor.hs
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE TypeFamilies #-}
import GHC.Prim (Constraint)
import qualified Data.Set as S
import qualified Data.Array.Unboxed as UA
-- RFunctor
View gist:5869498
{-# 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
You can’t perform that action at this time.