Term.lhs
I’ve just created Term.lhs. I’ll be filling it up with glue very shortly.
This entry was posted
on Thursday, January 20th, 2005 at 8:49 am and is filed under Hacking.
You can follow any responses to this entry through the RSS 2.0 feed.
You can skip to the end and leave a response. Pinging is currently not allowed.
I’ve hacked up the basics of the operational behaviour. Next up, a wee parser and printer, so we can have a bit of a play.
Module TermParser now contains a highly incomplete parser for fully elaborated raw terms, extracting them as a subset of the concrete syntax, given a resolver for names. You can try it out in ghci thus:
Sorry Conor I added code tags to that comment, feel free to reverse this :)
More excitement!
The test routine now takes term : type. It’s your responsibility to be accurate, as there’s no checker yet. You get back the Haskell show of the term, its whnf, its normal form and the type you supplied. The type is necessary (in general) for the quotation operation. Quotation of Whnv to get a whnf is very cheap, as it’s only skin deep. Quotation of normal forms requires a deeper traversal, and a name supply. However, a little inspired by the ∇-ists, I knocked up this little gadget
nu’s type is more informative, on the face of it: working in any idiom with a name supply, nu ty f gives you the scope-like thing made by abstracting x from (f x) where x is a fresh variable of type ty. Though I say so myself, the nice thing is that the new free variable doesn’t leak: by the time it reaches the outside world, it’s been bound again!