Re: [Haskell-cafe] adding recursion to a DSL

2013-02-19 Thread Emil Axelsson
You probably don't need recursion in the DSL for this (that would require a way to detect cycles in the expressions). For this example, it looks like all you need is to add something like `map` as a DSL construct. Your example could perhaps be expressed as forEach (1,1000) (\n - out

Re: [Haskell-cafe] Maintaining lambdabot

2013-02-19 Thread Jan Stolarek
I'm happy to hear your approval. I've spent some time yesterday cleaning up the code and writing down all things that do not work. The list I made is avaliable on github: https://github.com/killy/lambdabot/issues There are 17 open issues at the moment and I know I will not have enough

Re: [Haskell-cafe] adding recursion to a DSL

2013-02-19 Thread Edsko de Vries
Hi Joerg, You might find Abstract Syntax Graphs for Domain Specific Languages by Bruno Oliveira and Andres Löh ( http://ropas.snu.ac.kr/~bruno/papers/ASGDSL.pdf) a helpful reference to adding things like recursion (and other binding constructs) to your DSL. Edsko On Tue, Feb 19, 2013 at 9:47

[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] FunPtr to C function with #arguments determined atruntime?

2013-02-19 Thread Ertugrul Söylemez
Ryan Newton rrnew...@gmail.com wrote: My problem is that I can't create a type representing what I want at the Haskell type-check time, and I need such a type for either casting or a foreign import. For example, let's say the function takes a number of Int arguments between 1 and 1000. If I

Re: [Haskell-cafe] Subject: ANNOUNCE: grid-3.0.1 (tile maps for board games or maths)

2013-02-19 Thread Amy de Buitléir
Twan van Laarhoven twanvl at gmail.com writes: After taking a peek at the documentation: have you considered removing the size function from Grid? . . . It might also be useful to add a rectangular grid type where diagonally adjacent cells are also neighbors. . . . Another interesting idea

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] layers: A prototypical 2d platform game

2013-02-19 Thread Henk-Jan van Tuyl
On Mon, 18 Feb 2013 18:48:01 +0100, Daniel Trstenjak daniel.trsten...@gmail.com wrote: Hi all, also if there's not that much to see and only a few minutes of gameplay, but after spending quite a few hours writing it, getting a feeling for Haskell and it's usage, perhaps it's in some way

Re: [Haskell-cafe] layers: A prototypical 2d platform game

2013-02-19 Thread Daniel Trstenjak
Hi Henk-Jan, It seems to me that there is something missing from this e-mail. What are you missing? Greetings, Daniel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

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] layers: A prototypical 2d platform game

2013-02-19 Thread Vo Minh Thu
2013/2/19 Daniel Trstenjak daniel.trsten...@gmail.com: Hi Henk-Jan, It seems to me that there is something missing from this e-mail. What are you missing? Screenshots obviously ;) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

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] layers: A prototypical 2d platform game

2013-02-19 Thread Daniel Trstenjak
On Tue, Feb 19, 2013 at 02:15:33PM +0100, Vo Minh Thu wrote: Screenshots obviously ;) Hurray! attachment: layers.png___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] layers: A prototypical 2d platform game

2013-02-19 Thread Mateusz Kowalczyk
On 19/02/13 13:39, Daniel Trstenjak wrote: On Tue, Feb 19, 2013 at 02:15:33PM +0100, Vo Minh Thu wrote: Screenshots obviously ;) Hurray! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] What is a Haskell way to implement flags?

2013-02-19 Thread Branimir Maksimovic
In C usual way is to set some bit in integer variable by shifting or oring,and than check flag integer variable by anding with particular flag value.What is Haskell way? Thanks. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] What is a Haskell way to implement flags?

2013-02-19 Thread mukesh tiwari
The same as C way. You can import Data.Bits and can use the functions. Prelude import Data.Bits Prelude Data.Bits Data.Bits. Data.Bits... Data.Bits.bitDefault Data.Bits.complementBit Data.Bits.rotate Data.Bits.shift Data.Bits.testBitDefault Data.Bits..|.Data.Bits.bitSize

Re: [Haskell-cafe] Maintaining lambdabot

2013-02-19 Thread James Cook
For what it's worth, I also have a fork of lambdabot[1] I've been using for quite a while now, which may provide a cleaner starting point. In particular, it updates the plugin and command API to be (IMO) quite a bit cleaner and easier to use and understand. It could probably use some

Re: [Haskell-cafe] What is a Haskell way to implement flags?

2013-02-19 Thread Donn Cave
Quoth Branimir Maksimovic bm...@hotmail.com, In C usual way is to set some bit in integer variable by shifting or oring, and than check flag integer variable by anding with particular flag value. What is Haskell way? Of course you may do the very same thing, if you like. I think if there's

Re: [Haskell-cafe] What is a Haskell way to implement flags?

2013-02-19 Thread Brandon Allbery
On Tue, Feb 19, 2013 at 10:11 AM, Branimir Maksimovic bm...@hotmail.comwrote: In C usual way is to set some bit in integer variable by shifting or oring, and than check flag integer variable by anding with particular flag value. What is Haskell way? You can do that, but a somewhat more

Re: [Haskell-cafe] layers: A prototypical 2d platform game

2013-02-19 Thread Henk-Jan van Tuyl
On Tue, 19 Feb 2013 13:55:14 +0100, Daniel Trstenjak daniel.trsten...@gmail.com wrote: Hi Henk-Jan, It seems to me that there is something missing from this e-mail. What are you missing? The message starts with the word also, so it looks if there should be some other text in front of

Re: [Haskell-cafe] Free lunch with GADTs

2013-02-19 Thread Mark Flamer
Tristan, Please let me know how this works out for you. I was struggling with something similar over the last few days. It's expressed in these 2 S.O. questions. In my case I'm going to probably just move on and stick with a standard ADT for now. It was interesting to explore the possibilities

Re: [Haskell-cafe] Maintaining lambdabot

2013-02-19 Thread Jan Stolarek
Wow, this indeed looks like a nice starting point, though I can't build lambdabot from your repo - seems that dice package is not on Hackage. Is this the package that you rely on: https://github.com/serialhex/dice ? Anyway, how would you feel about changes that I would like to make: - move all

Re: [Haskell-cafe] Maintaining lambdabot

2013-02-19 Thread James Cook
Sorry, I uploaded it this morning since I knew it wasn't there (it's the dice repo from my github account, mokus0). Have you run cabal update in the last 4 or 5 hours? On Feb 19, 2013, at 2:36 PM, Jan Stolarek jan.stola...@p.lodz.pl wrote: Wow, this indeed looks like a nice starting point,

Re: [Haskell-cafe] Maintaining lambdabot

2013-02-19 Thread Gwern Branwen
On Tue, Feb 19, 2013 at 5:36 PM, Jan Stolarek jan.stola...@p.lodz.pl wrote: - remove unlambda, brainfuck and show from the repo. They are on hackage, no need to keep them here - these packages aren't even used in the build process. Where will they go? -- gwern http://www.gwern.net

Re: [Haskell-cafe] Maintaining lambdabot

2013-02-19 Thread James Cook
On Feb 19, 2013, at 2:36 PM, Jan Stolarek jan.stola...@p.lodz.pl wrote: Anyway, how would you feel about changes that I would like to make: - move all modules into Lambdabot. namespace - remove unlambda, brainfuck and show from the repo. They are on hackage, no need to keep them here -

[Haskell-cafe] Parsec without data declarations/AST

2013-02-19 Thread Sean Cormican
I have been trying to create a parser for a functional programming language, but there is no need to create an AST but merely check that the code is valid according to the grammar. In the following tutorial I have been trying to take some pointers from, data declarations are used to create an AST

Re: [Haskell-cafe] Parsec without data declarations/AST

2013-02-19 Thread Alexander Solla
If all you want to do is check that the code is valid (i.e., you aren't going to interpret the code), you can just return a Bool. If you want to interpret it, but don't want to have a Stmt type, you can return IO () actions. In that case, the parser's type will be Parser (IO ()) I think an

Re: [Haskell-cafe] Parsec without data declarations/AST

2013-02-19 Thread Alexander Solla
Come to think of it, a parsec parser already wraps over Either, so if all you want to do is check if a result is valid, you can abuse the Either semantics so that your type is: Parser () -- the parser which returns nothing on success or an error on failure. On Tue, Feb 19, 2013 at 3:20 PM,

Re: [Haskell-cafe] What is a Haskell way to implement flags?

2013-02-19 Thread Ertugrul Söylemez
Brandon Allbery allber...@gmail.com wrote: In C usual way is to set some bit in integer variable by shifting or oring, and than check flag integer variable by anding with particular flag value. What is Haskell way? You can do that, but a somewhat more idiomatic way would be a list (or,

[Haskell-cafe] ANNOUNCE: smallcheck-1.0

2013-02-19 Thread Roman Cheplyaka
I am glad to announce a new major release of SmallCheck, a property-based testing library for Haskell. The major changes in this release are documented here: http://ro-che.info/articles/2013-02-19-smallcheck.html Roman ___ Haskell-Cafe mailing list

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] generalized, tail-recursive left fold that can

2013-02-19 Thread oleg
That said, to express foldl via foldr, we need a higher-order fold. There are various problems with higher-order folds, related to the cost of building closures. The problems are especially severe in strict languages or strict contexts. Indeed, foldl_via_foldr f z l = foldr (\e a z

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

Re: [Haskell-cafe] Maintaining lambdabot

2013-02-19 Thread Jason Dagit
On Tue, Feb 19, 2013 at 3:01 PM, James Cook mo...@deepbondi.net wrote: On Feb 19, 2013, at 2:36 PM, Jan Stolarek jan.stola...@p.lodz.pl wrote: Anyway, how would you feel about changes that I would like to make: - move all modules into Lambdabot. namespace - remove unlambda, brainfuck and

Re: [Haskell-cafe] Maintaining lambdabot

2013-02-19 Thread Jan Stolarek
Dnia wtorek, 19 lutego 2013, Gwern Branwen napisał: On Tue, Feb 19, 2013 at 5:36 PM, Jan Stolarek jan.stola...@p.lodz.pl wrote: - remove unlambda, brainfuck and show from the repo. They are on hackage, no need to keep them here - these packages aren't even used in the build process. Where

[Haskell-cafe] Parser left recursion

2013-02-19 Thread Martin Drautzburg
Hello all, this was previously asked on haskell-beginners, but only partially answered. As an exercise I am writing a parser roughly following the expamples in Graham Hutton's book. The language contains things like: data Exp = Lit Int -- literal integer | Plus Exp Exp My naive

Re: [Haskell-cafe] Maintaining lambdabot

2013-02-19 Thread Jan Stolarek
I have no objections to any of these, Great. Then I will start making mentioned changes and sending pull requests when I find some free time. though I would recommend as Gwern hinted that if related packages are to be removed that they should also be given new homes - I believe that the

Re: [Haskell-cafe] Parser left recursion

2013-02-19 Thread Roman Cheplyaka
* Martin Drautzburg martin.drautzb...@web.de [2013-02-20 08:13:16+0100] I do know for sure, that it is possible to parse (1+2)+3 (ghci does it just fine). But I seem to be missing a trick. Can anyone shed some light on this? The trick in this case is that ghci doesn't use a recursive