[Haskell-cafe] Who generates Haskell code and uses type
information at runtime? (fwd)
Chris Brown
chris at techniumcast.com
Wed Mar 18 08:14:47 EDT 2009
I'm not sure if you got my previous message, as I was having some
problems posting to the list...
> Putting in a nutshell, I generalize an extensional defined function
> definition into a recursive one. This is done in a number of steps by
> modifying expressions and exploiting type information of
> sub-expressions. For example:
>
> rev [] = []
> rev [a] = [a]
> rev [a,b] = [b,a]
> rev [a,b,c] = [c,b,a]
>
> ~~>
>
> rev x = y
>
> ~~>
>
> rev [] = []
> rev (x:xs) = (y:ys)
>
> ~~>
>
> rev [] = []
> rev (x:xs) = (last (x:xs)) : (reverse (x:xs))
>
>
> The initial set of rules is given by the user (in a file, via IO, ...).
> The problem later is to infer the type of an intermediate variable, e.g.
> 'y'.
I'm still not entirely sure what you want to do here. But it sounds like HaRe
could already do most of this for you via a sequence of folds, unfolds,
introduce pattern matching and generative folding. HaRe already has
built-in support for some symbolic evaluation, which is already used in the generative
fold refactoring, and has type checking support too.
http://www.cs.kent.ac.uk/projects/refactor-fp/hare.html
If it doesn't do exactly what you want out of the tin, it does have a large API
for designing transformations over Haskell code.
http://www.cs.kent.ac.uk/projects/refactor-fp/hare/haddock/RefacUtils.html
Chris.
>
> Thanks,
>
> Martin
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
--
Chris Brown
Visualization Software Engineer, Peiriannydd Meddalwedd Delweddu.
Cast Ltd., Technium CAST,
Ffordd Penlan, Parc Menai,
Bangor, Gwynedd UK. LL57 4HJ.
Tel: +44 (0)1248 675038
Fax: +44 (0)1248 675012
Mobile: +44 (0)7917 763712
--
Centre for Advanced Software Technology Limited is a limited company registered in England and Wales.
Registered Number: 04473521, Registered Office: Finance Office, Bangor University, College Road, Bangor, Gwynedd. LL57 2DG.
More information about the Haskell-Cafe
mailing list