> Yeah, subject "Finally Tagless" again, sorry, I'm just not done with it yet.
>
> In Olegs haskell implementation he is using classes mainly to model the
> syntax and instances to use for evaluators / compilers to allow multiple
> interpretations.
>
> I wonder if it'd be possible to do the same without classes using data types
> instead?
>
> Something similar to what Luke Palmer has done here:
>
> http://lukepalmer.wordpress.com/2010/01/24/haskell-antipattern-existential-typeclass/

Günther,

You can just use the dictionary translation of type classes to replace
them with data types:

E.g.

class Eval sem where
  val :: Int -> sem Int
  add :: sem Int -> sem Int -> sem Int

>-->

data EvalDict sem = EvalDict { val :: Int -> sem Int, add :: sem Int
-> sem Int -> sem Int }

Cheers,

Tom
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to