Re:Writing a Lisp: Explicit Stack and Stacktraces
by penpapersw on Friday May 12, 2017 @12:12PM
(#14325231)
Back when I wanted to write a Lisp interpreter, I thought Haskell would be one of the best languages for it because of its type system. But looking at this code, although I'm sure it's probably very good, it just doesn't strike me as very intuitive or readable. Is this something you get used to over time, like reading Lisp code? Or is it just inherently harder for non-mathematically-minded people to read?
[ Parent
| on HN ]
Re:Writing a Lisp: Explicit Stack and Stacktraces
by gavinpc on Friday May 12, 2017 @12:46PM
(#14325540)
I had the same reaction. The only part of this that I could read was a little surprising:
pop :: CallstackIO ()
pop =
modify popFrame
where popFrame (_:xs) =
xs
popFrame xs =
xs
Not that it's very onerous to implement, but I would expect these "pop" semantics to be imported from some more general type (or trait, or whatever Haskell uses for type composition). That said, I don't know what `modify` means.
Re:Writing a Lisp: Explicit Stack and Stacktraces
by reinvdwoerd on Friday May 12, 2017 @03:56PM
(#14327367)
From the documentation:
"Maps an old state to a new state inside a state monad. The old state is thrown away."
https://hackage.haskell.org/package/mtl-2.2.1/docs/Control-M...