A shallow embedding would typically use just functions - a famous
example is Paul Hudak's region server. A deep embedding would build
syntax - represented with data types - and interpret the syntax or
compile the syntax for another use (so called off-shoring e.g. Conal
Elliott's Pan).
A shallow embedding would typically use just functions - a famous
example is Paul Hudak's region server. A deep embedding would build
syntax - represented with data types - and interpret the syntax or
compile the syntax for another use (so called off-shoring e.g. Conal
Elliott's Pan).
I am
On 23 March 2011 10:28, C K Kashyap ckkash...@gmail.com wrote:
I am not able to ascertain if what you are saying is consistent with
http://www.haskell.org/haskellwiki/Embedded_domain_specific_language
Regards,
Kashyap
Well - I'm not sure if the description of a shallow embedding on that
Hi,
With my edsl, one can describe a tree like this -
import TreeEdsl
import Data.Tree
createTree :: TreeContext String ()
createTree = do
insertSubTree Fruits $ do
insertLeaf Apple
insertLeaf Mango
insertSubTree Arbitrary $ do
insertSubTree Numbers $ do
insertLeaf 1
insertLeaf 2
insertLeaf 3
You could turn 'insertSubTree' into and operator, and shorten insertLeaf
createTree = do
Fruits + do
leaf Apple
leaf Mango
Arbitrary + do
leaf 1
-- and so on...
It's a little bit more concise.
But I fail to see the use of TreeContext
If you add an instance of IsString to handle leaf construction you can get
it down to
Fruits + do
Apple
Mango
Arbitrary + do
1
...
But I also don't see the point of doing this in a monad.
-Edward
On Tue, Mar 22, 2011 at 1:15 PM, Yves Parès
Andy Gill uses a monad in his Dot library to allow graphs to have
references as they are built. It's a pattern I like a lot and has been
very useful for my graphics kit Wumpus.
That said, while it's a good technique for graphs, its use is more
equivocal for trees where nesting is more prominent.
On Tue, Mar 22, 2011 at 2:20 PM, Edward Kmett ekm...@gmail.com wrote:
If you add an instance of IsString to handle leaf construction you can get
it down to
Fruits + do
Apple
Mango
Arbitrary + do
1
...
But I also don't see the point of doing this in a
Hi,
I've tried a non-monadic version based on the suggestions here -
https://github.com/ckkashyap/LearningPrograms/blob/master/Haskell/edsl/TreeWithoutMonad.hs
This implementation seems to lack the indentation based approach that the
do syntax allows.
Would I be right if I said that the