Wednesday, April 25, 2012

ImperativeHaskell and Loops

ImperativeHaskell- has been released and is posted on Hackage. This version has an addition that significantly simplifies using ImperativeHaskell with existing code. In this version I've added a template function "liftOp" which uses the type of its argument to convert its argument into a function in the style of ImperativeHaskell. There are more details in the documentation. I have noticed a potential problem however. "continue';" and "break';" will only work inside of a loop, and will cause an error if used outside of a loop. A type level way of ensuring that they are only used in loops is clearly needed. Turning "Control" into a GADT and adding a phantom type turned out to not be the way (necessarily). Perhaps some logic programing with typeclasses in combination with this method is necessary.