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 DefaultSignatures #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE DeriveGeneric #-} -- Only needed for the DSL example | |
import GHC.Generics | |
-- Data types that are constant and uninteresting | |
class Eq a => Const a |
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
main = do | |
chars <- getLine | |
let otherchars = do | |
a <- chars | |
b <- chars | |
[a] ++ [b] | |
putStrLn otherchars |
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 DeriveFunctor #-} | |
{-# language FlexibleInstances #-} | |
import Data.Function | |
class Functor w => Comonad w where | |
extract :: w a -> a | |
duplicate :: w a -> w (w a) | |
kfix :: ComonadApply w => w (w a -> a) -> w a |
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 #-} | |
{-# Language DataKinds #-} | |
{-# Language KindSignatures #-} | |
{-# Language ViewPatterns #-} | |
{-# Language RankNTypes #-} | |
{-# Language ScopedTypeVariables #-} | |
import Control.Applicative |
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 PolyKinds, DataKinds, GADTs, TypeOperators, ConstraintKinds, RankNTypes, MultiParamTypeClasses, FlexibleInstances, FlexibleContexts, UndecidableInstances #-} | |
import Data.Proxy | |
import Data.Functor.Identity | |
import GHC.Exts (Constraint) | |
data HKList :: (k -> *) -> [k] -> * where | |
Nil :: HKList f '[] | |
(:*) :: f x -> HKList f xs -> HKList f (x ': xs) | |
OlderNewer