Wearing the hair shirt Wearing the hair shirt - Microsoft Research

Wearing the hair shirt Wearing the hair shirt - Microsoft Research Wearing the hair shirt Wearing the hair shirt - Microsoft Research

research.microsoft.com
from research.microsoft.com More from this publisher
27.12.2013 Views

Combinator libraries Recursive values are jolly useful type Parser a = String -> (a, String) exp :: Parser Expr exp = lit “let” decls lit “in” exp ||| exp aexp ||| ...etc... This is illegal in ML, because of the value restriction Can only be made legal by eta expansion. But that breaks the Parser abstraction, and is extremely gruesome: exp x = (lit “let” decls lit “in” exp ||| exp aexp ||| ...etc...) x

Combinator libraries<br />

Recursive values are jolly useful<br />

type Parser a = String -> (a, String)<br />

exp :: Parser Expr<br />

exp = lit “let” decls lit “in” exp<br />

||| exp aexp<br />

||| ...etc...<br />

This is illegal in ML, because of <strong>the</strong> value restriction<br />

Can only be made legal by eta expansion.<br />

But that breaks <strong>the</strong> Parser abstraction,<br />

and is extremely gruesome:<br />

exp x = (lit “let” decls lit “in” exp<br />

||| exp aexp<br />

||| ...etc...) x

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!