Skip to content

Instantly share code, notes, and snippets.

@andy-morris
Created November 19, 2011 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andy-morris/1378940 to your computer and use it in GitHub Desktop.
Save andy-morris/1378940 to your computer and use it in GitHub Desktop.
wootles
anders:DisML ± cat f.dis {git:DisML@pretty}!
fun type f: int*int -> int
| f (x,y) if x < y = x+y+7
| ... if x == y = x+y
| ... = y-x
anders:DisML ± dist/build/DisML/disml < f.dis {git:DisML@pretty}!
Program {unProgram = [TLDecls [FunDecl [FunD (Just (FunType (Id "f") (Type []
(ArrT (ProdT [NameT (Name False (CId "int")) (Pos {posChar = 16, posLine = 1,
posCol = 17}),NameT (Name False (CId "int")) (Pos {posChar = 22, posLine = 1,
posCol = 23})]) (NameT (Name False (CId "int")) (Pos {posChar = 30, posLine =
2, posCol = 4}))) (Pos {posChar = 30, posLine = 2, posCol = 4})))) [FunClause
(Just (FunHead False (Name False (Id "f")) [TupP [NameP (Name False (CId "x"))
(Pos {posChar = 36, posLine = 2, posCol = 10}),NameP (Name False (CId "y"))
(Pos {posChar = 38, posLine = 2, posCol = 12})] (Pos {posChar = 41, posLine =
2, posCol = 15})] (Pos {posChar = 41, posLine = 2, posCol = 15}))) Nothing
(Just (AppE [NameE (Name False (CId "x")) (Pos {posChar = 45, posLine = 2,
posCol = 19}),NameE (Name False (CId "<")) (Pos {posChar = 47, posLine = 2,
posCol = 21}),NameE (Name False (CId "y")) (Pos {posChar = 49, posLine = 2,
posCol = 23})])) (AppE [NameE (Name False (CId "x")) (Pos {posChar = 52,
posLine = 2, posCol = 26}),NameE (Name False (CId "+")) (Pos {posChar = 53,
posLine = 2, posCol = 27}),NameE (Name False (CId "y")) (Pos {posChar = 54,
posLine = 2, posCol = 28}),NameE (Name False (CId "+")) (Pos {posChar = 55,
posLine = 2, posCol = 29}),LitE (Integer 7) (Pos {posChar = 59, posLine = 3,
posCol = 4})]) (Pos {posChar = 59, posLine = 3, posCol = 4}),FunClause Nothing
Nothing (Just (AppE [NameE (Name False (CId "x")) (Pos {posChar = 71, posLine =
3, posCol = 16}),NameE (Name False (CId "==")) (Pos {posChar = 73, posLine = 3,
posCol = 18}),NameE (Name False (CId "y")) (Pos {posChar = 75, posLine = 3,
posCol = 20})])) (AppE [NameE (Name False (CId "x")) (Pos {posChar = 78,
posLine = 3, posCol = 23}),NameE (Name False (CId "+")) (Pos {posChar = 79,
posLine = 3, posCol = 24}),NameE (Name False (CId "y")) (Pos {posChar = 83,
posLine = 4, posCol = 4})]) (Pos {posChar = 83, posLine = 4, posCol =
4}),FunClause Nothing Nothing Nothing (AppE [NameE (Name False (CId "y")) (Pos
{posChar = 92, posLine = 4, posCol = 13}),NameE (Name False (CId "-")) (Pos
{posChar = 93, posLine = 4, posCol = 14}),NameE (Name False (CId "x")) (Pos
{posChar = 94, posLine = 5, posCol = 1})]) (Pos {posChar = 94, posLine = 5,
posCol = 1})] (Pos {posChar = 94, posLine = 5, posCol = 1})] (Pos {posChar =
94, posLine = 5, posCol = 1})] (Pos {posChar = 94, posLine = 5, posCol = 1})]}
fun type f: int × int → int
| f (x, y) if x < y = x + y + 7
| … if x == y = x + y
| … = y - x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment