Re: [Haskell-cafe] ANN: data-fix-cse -- Common subexpression elimination for EDSLs

2013-02-23 Thread Anton Kholomiov
I don't know how to express it. You need to have some dynamic representation since dag is a container of `(Int, f Int)`. I've tried to go along this road type Exp a = Fix (E a) data E c :: * - * where Lit :: Show a = a - E a c Op :: Op a - E a c App :: Phantom (a - b) c - Phantom a c - E

Re: [Haskell-cafe] ANN: data-fix-cse -- Common subexpression elimination for EDSLs

2013-02-22 Thread Conal Elliott
On Tue, Feb 19, 2013 at 9:28 PM, Anton Kholomiov anton.kholom...@gmail.comwrote: Do you think the approach can be extended for non-regular (nested) algebraic types (where the recursive data type is sometimes at a different type instance)? For instance, it's very handy to use GADTs to capture

Re: [Haskell-cafe] ANN: data-fix-cse -- Common subexpression elimination for EDSLs

2013-02-21 Thread Emil Axelsson
This should be possible using higher-order terms, as in http://hackage.haskell.org/packages/archive/compdata/latest/doc/html/Data-Comp-Multi-Term.html The only complication I see is that the Dag nodes would get heterogeneous types requiring existential quantification with a `Typeable`

[Haskell-cafe] ANN: data-fix-cse -- Common subexpression elimination for EDSLs

2013-02-19 Thread Anton Kholomiov
I'm glad to announce the package for Common subexpression elimination [1]. It's an implementation of the hashconsig algorithm as described in the paper 'Implementing Explicit and Finding Implicit Sharing in EDSLs' by Oleg Kiselyov. Main point of the library is to define this algorithm in the most

Re: [Haskell-cafe] ANN: data-fix-cse -- Common subexpression elimination for EDSLs

2013-02-19 Thread Emil Axelsson
2013-02-19 12:10, Anton Kholomiov skrev: I'm glad to announce the package for Commonsubexpression elimination [1]. It's an implementation of the hashconsig algorithm as described in the paper 'Implementing Explicit and Finding Implicit Sharing in EDSLs' by Oleg Kiselyov. Main point of the

Re: [Haskell-cafe] ANN: data-fix-cse -- Common subexpression elimination for EDSLs

2013-02-19 Thread Anton Kholomiov
There are several packages that already define fixpoints (another one is about unification), but all packages that I'm aware of define a lot of functionality that I don't need (and actually don't understand, packages with fixpoint types tend to be rather dense with math). I'd like it to be simple

Re: [Haskell-cafe] ANN: data-fix-cse -- Common subexpression elimination for EDSLs

2013-02-19 Thread Emil Axelsson
Fully understandable! Compdata would be quite a heavy dependency for your library. I'm just generally fond of the idea of collecting all DSL implementation tricks under one umbrella. That requires using the same term representation. / Emil 2013-02-19 14:12, Anton Kholomiov skrev: There are

Re: [Haskell-cafe] ANN: data-fix-cse -- Common subexpression elimination for EDSLs

2013-02-19 Thread Conal Elliott
What a delightfully elegant approach to CSE! I've been thinking about CSE for DSELs and about functor fixpoints, but it never occurred to me to put the two together. Do you think the approach can be extended for non-regular (nested) algebraic types (where the recursive data type is sometimes at a

Re: [Haskell-cafe] ANN: data-fix-cse -- Common subexpression elimination for EDSLs

2013-02-19 Thread Anton Kholomiov
Do you think the approach can be extended for non-regular (nested) algebraic types (where the recursive data type is sometimes at a different type instance)? For instance, it's very handy to use GADTs to capture embedded language types in host language (Haskell) types, which leads to