module haskell imports libstrategolib signatures/- signature constructors TopLevel: Ex -> Ex rules hs: TopLevel(x) -> $[import System.IO data IOStream = StdIO stdio :: IO IOStream stdio = return StdIO receives :: Show b => IO a -> b -> IO a receives s d = do temp <- s putStr(show d) return temp main = do [x]] hs: Stdio() -> $[stdio] hs: Int(x) -> x hs: Sum(x) -> $[sum [x]] hs: Receives(x, y) -> $[[x] `receives` [y]] hs: [] -> $<[]> hs: [x | xs] -> $<[<x><xs>]> strategies // wrap expression in a toplevel and then apply code generation haskell = !TopLevel(); hs // translate each element of a list, prepending each with ',', and concatenate hstail = foldr(!"", \ (x,y) -> $<, <x>> \) // Interface haskell code generation with editor services and file system to-haskell: (selected, _, _, path, project-path) -> (filename, result) with filename := path ; result := selected