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 AST where | |
data AST | |
= [Name] :=> AST | |
| Name :? AST | |
| App [AST] | |
| Atom String | |
| Const Integer | |
| Force AST |
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
:- use_module(library(lists)). | |
construct(Fields, Record) | |
:- Record =.. [record | Fields] | |
. | |
% synonym | |
% | |
make --> construct. | |
build --> destruct. |
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
import Control.Applicative | |
import Control.Monad.Reader | |
import Control.Monad.State | |
import Control.Monad.Error | |
import Text.Printf | |
data Step |
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
{- | |
This module is all about New Yourk Minutes (NYMs). | |
NYM is [year, month, day, hour, minute] combination where | |
you can uniquely determine who-is-who. | |
-} | |
import Control.Monad (guard) | |
import Data.List (permutations) |
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
{- three next declarations are declaring the same thing -} | |
test0 :: [Int] | |
test0 = do | |
x <- [2..5] -- for all x from [2.. 5] | |
y <- [x - 1, x, x + 1] -- for all y from [x - 1.. x + 1] | |
return y -- return y | |
{- |
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 type NAME = | |
sig | |
type t | |
val fresh : unit -> t | |
end | |
module type STORAGE = functor (Name : NAME) -> | |
sig |
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 : FreeCell | |
Description : A library for Freecell | |
Copyright : (c) Timothy Dees, 2014 | |
License : MIT | |
Maintainer : [email protected] | |
Stability : experimental | |
This lets you play FreeCell. It's fun, I think. | |
-} |
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 Behaviour where | |
import Event | |
type Behaviour ref a = ref a | |
stepper :: EventContext clip m ref => a -> Event clip m ref a -> m (Behaviour ref a) | |
stepper initial event = do | |
behaviour <- new initial |
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
primes = filter isPrime [1..] | |
isPrime p = case p of | |
1 -> False | |
2 -> True | |
n -> notDivisor n `all` lowerThanSqrt | |
where | |
lowerThanSqrt = takeWhile (\p -> p * p <= n) primes |
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
:- use_module(library(clpfd)). | |
run(Strat) :- | |
empty(M), | |
rain_drop(M, M1), | |
loop(Strat, 0, M1). | |
loop(_, N, M) :- |