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
abstract Simple = { | |
flags startcat = Object; | |
cat Object; Quality; | |
fun | |
Meal, Drink: Object; | |
Tasty, Exotic: Quality; | |
QObject: Quality -> Object -> Object; | |
And: Object -> Object -> Object; | |
} |
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
get_db() { | |
if [ -z "$CABAL_SANDBOX_CONFIG" ] | |
then | |
db="" | |
else | |
db=$(sed -nr -e 's/^package-db: (.*)/\1/p' "$CABAL_SANDBOX_CONFIG") | |
if [ $? -ne 0 ]; then exit 1; fi | |
fi | |
} | |
db_cmd() ( |
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
{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, ScopedTypeVariables, DeriveDataTypeable #-} | |
import Test.Tasty | |
import Test.Tasty.Providers | |
import Test.Tasty.Options | |
import Test.Tasty.SmallCheck | |
import Test.Tasty.Runners | |
import Test.SmallCheck.Series | |
import Control.Applicative | |
import Data.Tagged |
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
{-# LANGUAGE GADTs, EmptyDataDecls, MultiParamTypeClasses, TypeFamilies #-} | |
{-# LANGUAGE DeriveDataTypeable, StandaloneDeriving #-} | |
import Data.Generics | |
import Data.Typeable | |
import Data.Data | |
data HasHoles | |
data Complete | |
deriving instance Typeable HasHoles |
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
{-# LANGUAGE OverloadedStrings, TemplateHaskell #-} | |
import Data.Aeson | |
import Data.Aeson.TH | |
import qualified Data.ByteString.Lazy as BS | |
import Control.Applicative | |
import Control.Monad | |
instance FromJSON GName where | |
parseJSON (Object v) = | |
GName <$> |
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
-- Arrowized version of https://github.com/tcrayford/rematch | |
{-# LANGUAGE RankNTypes, Arrows, FlexibleInstances, MultiParamTypeClasses #-} | |
module ArrowMatcher where | |
import Prelude hiding ((.), id) | |
import Control.Applicative | |
import Control.Category | |
import Control.Arrow | |
import Control.Arrow.Transformer |
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
-- In response to http://existentialtype.wordpress.com/2012/12/03/exceptions-are-shared-secrets/ | |
{-# LANGUAGE DeriveDataTypeable #-} | |
module MyException | |
( Secret | |
, MyException | |
, throwMyException | |
, handleMyException | |
) where |
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
(define (return v) (lambda (s ks kf) (ks v s))) | |
(define fail (lambda (s ks kf) (kf))) | |
; >>= | |
(define (bind a f) | |
(lambda (s ks kf) | |
(a s | |
(lambda (av s1) ((f av) s1 ks kf)) | |
kf))) |
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
-- http://users.livejournal.com/_darkus_/641529.html | |
-- Usage: runghc jars.hs 5 8 2 | |
import Control.Category | |
import Control.Applicative | |
import Control.Monad.Logic | |
import Control.Monad.Writer | |
import Control.Monad.Reader | |
import Control.Monad.State | |
import Data.List |
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
; In reply to https://gist.github.com/1405389 | |
(define (map f lst) | |
(letrec | |
((go (lambda (lst k) | |
(if (null? lst) | |
(k '()) | |
(go (cdr lst) | |
(lambda (rest) | |
(k (cons (f (car lst)) rest)))))))) | |
(go lst (lambda (x) x)))) |