[Haskell-cafe] adding recursion to a DSL

fritsch at joerg.cc fritsch at joerg.cc
Sun Feb 17 23:53:08 CET 2013


I have a tiny DSL that actually works quite well. When I say 

import language.CWMWL

main = runCWMWL $ do
    out (matrixMult, A, 1, row, matrix-row)

then runCWMWL is a function that is exported by language.CWMWL. This parses the experession and takes some action.

Now, A is the name of the matrix and the third tuple element would represent the numbe of the row. For example 1 to 10000. I want to achieve some sort of "elegant" (means readable code, a good representation) recursion that would let me do something like 
   sequence [ out (matrixMult, A, n, row, matrix-row) | n <- [1..1000] ] 
but in a nicer manner an without expending this to 10000 lines of code at compile time.

How can I best introduce recursion into my DSL or borrow this from the host language Haskell "effectively"? 

--Joerg





More information about the Haskell-Cafe mailing list