Re: [Haskell-cafe] Typeable typeclass and type-level naturals

2013-06-02 Thread Roman Cheplyaka
Try adding deriving instance Typeable 'Zero deriving instance Typeable a = Typeable ('Succ a) to your module. (I haven't tested it — you might need to tweak it a bit.) Roman * TP paratribulati...@free.fr [2013-06-02 18:08:02+0200] Hi all, I try to play with the Typeable typeclass, and

Re: [Haskell-cafe] Stream instance for Parsec + conduits

2013-05-28 Thread Roman Cheplyaka
Hi Phil, Sorry for the late answer — somehow I missed your email when it was originally posted. Parsec wasn't designed for incremental input, and adding it without modifying the internals would be tricky. The problem with your code is this: at the branching point, Parsec remembers the current

Re: [Haskell-cafe] Design of extremely usable programming language libraries

2013-05-28 Thread Roman Cheplyaka
* Andrey Chudnov achud...@gmail.com [2013-05-28 16:36:14-0400] * Does any generic traversal/transformation (uniplate-style) library support GADTs? Any syb-style library works with GADTs, by the virtue of dealing with value representations instead of type representations. * What is the best

Re: [Haskell-cafe] Design of extremely usable programming language libraries

2013-05-28 Thread Roman Cheplyaka
Roman * Andrey Chudnov achud...@gmail.com [2013-05-28 17:29:10-0400] Thanks for a prompt reply, Roman. On 05/28/2013 04:52 PM, Roman Cheplyaka wrote: Any syb-style library works with GADTs, by the virtue of dealing with value representations instead of type representations. I tried to use

[Haskell-cafe] ANNOUNCE: haskell-packages-0.1

2013-05-27 Thread Roman Cheplyaka
I am happy to announce the first release of haskell-packages. http://haskell-suite.github.io/haskell-packages/ There are two cases when you may need haskell-packages: if you are writing a Haskell compiler (or any tool that processes Haskell source code, such as a static analyzer), or if you

Re: [Haskell-cafe] question about type constructors

2013-05-23 Thread Roman Cheplyaka
* TP paratribulati...@free.fr [2013-05-23 00:34:57+0200] Hi, In the program I am trying to write, I have a problem that can be reduced to the following dummy example: -- {-# LANGUAGE GADTs #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE KindSignatures #-} {-#

[Haskell-cafe] ANNOUNCE: new bridge! (prelude-prime)

2013-05-23 Thread Roman Cheplyaka
I liked Andreas's idea (cited below). Hence the new package prelude-prime. https://github.com/feuerbach/prelude-prime http://hackage.haskell.org/package/prelude-prime Pull requests are welcome, but let's stick to widely agreed changes (like the Foldable/Traversable one). I think one of the

Re: [Haskell-cafe] question about type constructors

2013-05-23 Thread Roman Cheplyaka
* TP paratribulati...@free.fr [2013-05-23 13:23:36+0200] Roman Cheplyaka wrote: The rule of thumb is that you should never use IncoherentInstances. The proper way to do it is: data Person :: Gender - * where Person :: String - Person b Child

Re: [Haskell-cafe] ANNOUNCE: new bridge! (prelude-prime)

2013-05-23 Thread Roman Cheplyaka
* Manuel Gómez tar...@gmail.com [2013-05-23 08:33:15-0430] On Thu, May 23, 2013 at 3:07 AM, Roman Cheplyaka r...@ro-che.info wrote: Pull requests are welcome, but let's stick to widely agreed changes (like the Foldable/Traversable one). I think one of the reasons why other Preludes haven't

Re: [Haskell-cafe] accessing a type variable in instance declaration

2013-05-22 Thread Roman Cheplyaka
* TP paratribulati...@free.fr [2013-05-22 16:18:55+0200] Hi all, I wonder if there is some means to get a type variable value in the body of a class instance definition. It seems it is not possible (a workaround has already been given on this list), but I would like a confirmation. For

Re: [Haskell-cafe] accessing a type variable in instance declaration

2013-05-22 Thread Roman Cheplyaka
* TP paratribulati...@free.fr [2013-05-22 18:45:06+0200] Ok, thanks, I understand. Now, I'm stuck to compile this code (independent from my previous post, but related to it): --- {-# LANGUAGE DataKinds #-} {-# LANGUAGE KindSignatures #-} data Nat = Zero | Succ Nat type One

Re: [Haskell-cafe] How to throw an error if using cabal-install version XYZ?

2013-05-22 Thread Roman Cheplyaka
Perhaps I'm missing something, but why not just cabal-version: =1.18 ? It will constrain the Cabal version, not cabal-install, but judging from the fix[1] this is what you actually need. [1]: https://github.com/haskell/cabal/commit/d148336e97cda2e3585c453cf9af61bc3635131a Roman *

Re: [Haskell-cafe] parsing a CSV file

2013-05-21 Thread Roman Cheplyaka
* Roger Mason rma...@mun.ca [2013-05-21 12:22:53-0230] Thus far, I have: -- derived from RWH -- file: ch16/csv2.hs import Text.ParserCombinators.Parsec headerLines = endBy csvFile endHeader csvFile = endBy line eol line = sepBy cell (char ',') cell = many (noneOf ,\n) eol = char '\n'

Re: [Haskell-cafe] parsing a CSV file

2013-05-21 Thread Roman Cheplyaka
* Roger Mason rma...@mun.ca [2013-05-21 13:33:47-0230] Hi Roman, On 05/21/2013 12:36 PM, Roman Cheplyaka wrote: Clearly, my naiive implementation of endHeader is no good. Hi Roger, Not in scope means that that thing is not defined. So it's not a problem with your implementation

Re: [Haskell-cafe] DSL to English and back for game rule set?

2013-05-19 Thread Roman Cheplyaka
You should definitely look at Grammatical Framework http://www.grammaticalframework.org/ * Matthew O'Connor thegreendra...@gmail.com [2013-05-19 14:27:33-0600] Hello all, I recognize this isn't directly a Haskell-related question, but as I'd like to solve this problem in Haskell figured

Re: [Haskell-cafe] Compiler error in Parsec using ByteString

2013-05-18 Thread Roman Cheplyaka
Hi, General advice here is to put type signatures for all non-trivial definitions. This way you can see exactly where compiler and you disagree on what the type of something should be. In this particular case, by following the above recipe, I see that one problem is that `emptyDef` has type

[Haskell-cafe] Non-deterministic behaviour of aeson's parser

2013-05-18 Thread Roman Cheplyaka
I am observing a non-deterministic behaviour of aeson's parser. I'm writing here in addition to filing a bug report [1] to draw attention to this (pretty scary) problem. To try to reproduce this problem, do this: git clone https://gist.github.com/5604887.git aeson cd aeson ghc aeson.hs

Re: [Haskell-cafe] Non-deterministic behaviour of aeson's parser

2013-05-18 Thread Roman Cheplyaka
and because hashable has had subtle bugs in its C code before (see https://github.com/tibbe/hashable/issues/60). G On Sat, May 18, 2013 at 6:25 PM, Roman Cheplyaka r...@ro-che.info wrote: I am observing a non-deterministic behaviour of aeson's parser. I'm writing here in addition

Re: proposal for trailing comma and semicolon

2013-05-17 Thread Roman Cheplyaka
I use them sometimes, but would do that much more if they didn't require adding an extension. Roman * Edward Kmett ekm...@gmail.com [2013-05-17 15:24:27-0400] I personally use tuple sections a fair bit, though admittedly mostly for simple (,a) or (a,) cases. On Fri, May 17, 2013 at 3:01

Re: [Haskell-cafe] A use case for *real* existential types

2013-05-16 Thread Roman Cheplyaka
* o...@okmij.org o...@okmij.org [2013-05-11 05:26:55-] I must say though that I'd rather prefer Adres solution because his init init :: (forall a. Inotify a - IO b) - IO b ensures that Inotify does not leak, and so can be disposed of at the end. So his init enforces the region

[Haskell-cafe] Mutually recursive modules

2013-05-08 Thread Roman Cheplyaka
I wonder whether it's always possible to break cycles using GHC's .hs-boot files. Consider the following schematic example: module A where import B data A f :: B - A f = undefined B.g module B where import A data B g :: A - B g = undefined A.f A.hs-boot must give a

Re: [Haskell-cafe] Mutually recursive modules

2013-05-08 Thread Roman Cheplyaka
Ah yes, thank you! * Francesco Mazzoli f...@mazzo.li [2013-05-08 08:51:12+0100] At Wed, 8 May 2013 09:46:08 +0300, Roman Cheplyaka wrote: I wonder whether it's always possible to break cycles using GHC's .hs-boot files. Consider the following schematic example: module A where

Re: [Haskell-cafe] Lambda Calculus question on equivalence

2013-05-02 Thread Roman Cheplyaka
IIRC, Barendregt'84 monography (The Lambda Calculus: Its Syntax and Semantics) has a significant part of it devoted to this question. * Ian Price ianpric...@googlemail.com [2013-05-02 20:47:07+0100] Hi, I know this isn't perhaps the best forum for this, but maybe you can give me some

Re: Is it time to start deprecating FunDeps?

2013-04-30 Thread Roman Cheplyaka
1. What do you mean by deprecating? Deprecate it in GHC? What does it have to do with Haskell'? 2. What do you gain by doing so? 3. How do you translate cyclic dependencies? Roman * AntC anthony_clay...@clear.net.nz [2013-04-30 05:31:09+] Now that the Type Equality coercions extension

Re: [Haskell-cafe] GSoC proposal: Haskell AST-based refactoring and API upgrading tool

2013-04-29 Thread Roman Cheplyaka
* Niklas Hambüchen m...@nh2.me [2013-04-29 14:00:23+0800] I would like to propose the development of source code refactoring tool that operates on Haskell source code ASTs and lets you formulate rewrite rules written in Haskell. Hi Niklas, This is a great idea. I talked about it at HIW last

Re: [Haskell-cafe] pattern matching on data families constructors

2013-04-25 Thread Roman Cheplyaka
Let's look at it from the operational perspective. In the GADT case, the set of possibilities is fixed in advance (closed). Every GADT constructor has a corresponding tag (a small integer) which, when pattern-matching, tells us which branch to take. In the data family case, the set of

Re: [Haskell-cafe] createProcess interferes with sockets?

2013-04-22 Thread Roman Cheplyaka
* Evan Laforge qdun...@gmail.com [2013-04-22 12:41:33+0530] On Sun, Apr 21, 2013 at 9:25 PM, Donn Cave d...@avvanta.com wrote: Quoth Evan Laforge qdun...@gmail.com, sleep = Process.createProcess (Process.proc sleep [5]) sleep = Process.createProcess ((Process.proc sleep [5])

Re: [Haskell-cafe] version of containers fixed by template-haskell?

2013-04-17 Thread Roman Cheplyaka
* Johannes Waldmann waldm...@imn.htwk-leipzig.de [2013-04-17 08:10:21+] (Isn't it somewhat bold of cabal-install to offer to break ghc-7.6.2? like, this will completely hose the compiler?) ghc is the package that provides the GHC API. Breaking it should not affect the compiler itself, since

Re: [Haskell-cafe] version of containers fixed by template-haskell?

2013-04-17 Thread Roman Cheplyaka
On second thought, are you trying to install it globally? ghc is installed globally, and local packages should not break it. * Johannes Waldmann waldm...@imn.htwk-leipzig.de [2013-04-17 08:36:23+] Roman Cheplyaka roma at ro-che.info writes: ghc is the package that provides the GHC API

Re: [Haskell-cafe] Contravariant applicatives, monads and arrows (was ANN: rematch, an library for composable assertions with human readable failure messages)

2013-04-17 Thread Roman Cheplyaka
* Stephen Tetley stephen.tet...@gmail.com [2013-04-16 19:48:47+0100] On 16 April 2013 16:12, Alejandro Serrano Mena trup...@gmail.com wrote: Hi, First of all, let me say that this work on matchers is really useful :) Following Roman advice, I'm trying to find a more principled approach

Re: [Haskell-cafe] Contravariant applicatives, monads and arrows (was ANN: rematch, an library for composable assertions with human readable failure messages)

2013-04-17 Thread Roman Cheplyaka
You are right Alejandro, arrows are a perfect fit here. (Most of it is possible with monads as well, but arrows are useful to maintain static names of the properties.) Here's what I've come up with: https://gist.github.com/feuerbach/5409326 Now everyItem and hasJust have types everyItem ::

Re: [Haskell-cafe] Monad fold

2013-04-16 Thread Roman Cheplyaka
* Christopher Howard christopher.how...@frigidcode.com [2013-04-16 04:35:39-0800] So, I'm doing something like this foldl (=) someA list :: Monad m = m a where list :: Monad m = [a - m a], someA :: Monad m = m a Is there a more concise way to write this? I don't think foldM is

Re: [Haskell-cafe] Monad fold

2013-04-16 Thread Roman Cheplyaka
Right. See also this discussion: http://www.haskell.org/pipermail/libraries/2009-July/012106.html Roman * Tom Ellis tom-lists-haskell-cafe-2...@jaguarpaw.co.uk [2013-04-16 14:49:48+0100] On Tue, Apr 16, 2013 at 01:53:19PM +0100, Oliver Charles wrote: On 04/16/2013 01:47 PM, Lyndon Maydwell

Re: [Haskell-cafe] ANN: rematch, an library for composable assertions with human readable failure messages

2013-04-16 Thread Roman Cheplyaka
Hi Tom, This is a neat idea! I'd like to use something like this in smallcheck and test-framework-golden. The main obstacle to that is that your package depends on QuickCheck and HUnit, and every package using rematch would transitively depend on them, too. This has little sense, especially for

Re: [Haskell-cafe] ANN: rematch, an library for composable assertions with human readable failure messages

2013-04-16 Thread Roman Cheplyaka
* Tom Crayford tcrayf...@gmail.com [2013-04-16 15:24:07+0100] Re the Control namespace, these matchers aren't exclusively a testing tool. I've been using the core api for other purposes as well (primarily for validating forms in user interfaces in conjunction with digestive-functors). I

Re: [Haskell-cafe] Contravariant applicatives, monads and arrows (was ANN: rematch, an library for composable assertions with human readable failure messages)

2013-04-16 Thread Roman Cheplyaka
My idea was to convert Matcher to be a covariant functor. It would be essentially a Matcher which has been applied to the tested value. And the type argument would denote the result of a computation. For example, consider hasRight :: (Show a, Show b) = Matcher b - Matcher (Either a b)

Re: [Haskell-cafe] Google Summer of Code

2013-04-15 Thread Roman Cheplyaka
* Marcos Pividori marcospivid...@gmail.com [2013-04-15 22:47:41-0300] Hi, I am a Computer Science student from Argentina. I am interested in working this summer on some project related to Haskell for the Google Summer of Code. I have learned a lot about this, because in my career, we have a

Using old code generator

2013-04-12 Thread Roman Cheplyaka
Hi, I'm looking for a workaround for #7574 [1] (I run into it when trying to build the 'statistics' package with profiling enabled with GHC HEAD.) The symptom is ghc-stage2: panic! (the 'impossible' happened) (GHC version 7.7.20130407 for i386-unknown-linux): allocateRegsAndSpill:

Re: Using old code generator

2013-04-12 Thread Roman Cheplyaka
Message- | From: glasgow-haskell-users-boun...@haskell.org [mailto:glasgow-haskell- | users-boun...@haskell.org] On Behalf Of Roman Cheplyaka | Sent: 12 April 2013 11:27 | To: glasgow-haskell-users@haskell.org | Subject: Using old code generator | | Hi, | | I'm looking

Re: [Haskell-cafe] Which generic zipper?

2013-04-11 Thread Roman Cheplyaka
of GHC.Generics.Generic (I'll perhaps take a look), but maybe there's a generic Zipper library already based on the GHC stuff? On 2013-04-10, at 3:19 PM, Roman Cheplyaka r...@ro-che.info wrote: ...Apart from that, I am not aware of any problems with syz. Roman

Re: [Haskell-cafe] Numerics and Warnings

2013-04-10 Thread Roman Cheplyaka
* Barak A. Pearlmutter ba...@cs.nuim.ie [2013-04-10 15:38:35+0100] In fiddling around with some numeric code in Haskell, I noticed some issues. Basically, you get warnings if you write energy mass = mass * c^2 but not if you write energy mass = mass * c * c which seems a bit

Re: [Haskell-cafe] Numerics and Warnings

2013-04-10 Thread Roman Cheplyaka
* Aleksey Khudyakov alexey.sklad...@gmail.com [2013-04-10 23:20:15+0400] On 10 April 2013 22:25, Roman Cheplyaka r...@ro-che.info wrote: * Barak A. Pearlmutter ba...@cs.nuim.ie [2013-04-10 15:38:35+0100] In fiddling around with some numeric code in Haskell, I noticed some issues. Basically

Re: [Haskell-cafe] Which generic zipper?

2013-04-10 Thread Roman Cheplyaka
* Luke Evans l...@eversosoft.com [2013-04-10 15:00:40-0700] It's sometimes difficult to figure out a good choice when you're searching for a new feature/library (when you go beyond safety of the HP). I'm looking for a generic zipper to (hopefully) navigate over an AST… so a hetrogeneous

Re: [Haskell-cafe] Prolog-style patterns

2013-04-09 Thread Roman Cheplyaka
* Daniel Trstenjak daniel.trsten...@gmail.com [2013-04-09 09:37:46+0200] Hi Roman, One issue with it in Haskell is that it'd lead to inconsistent semantics: myEq x x = True is not the same as myEq x y = case y of x - True I don't think that it's

Re: [Haskell-cafe] Prolog-style patterns

2013-04-09 Thread Roman Cheplyaka
* Daniel Trstenjak daniel.trsten...@gmail.com [2013-04-09 13:01:07+0200] Hi Roman, In fact, lots of Haskell newcomers are surprised that f 10 = 42 is not the same as n = 10 f n = 42 Well, yes, at the beginning I've been also surprised about this. But allowing

Re: [Haskell-cafe] Prolog-style patterns

2013-04-09 Thread Roman Cheplyaka
* Malcolm Wallace malcolm.wall...@me.com [2013-04-09 15:34:01+0100] On 9 Apr 2013, at 14:46, Sturdy, Ian wrote: As far as the use of Eq goes, Eq is already enshrined in pattern matching by pattern matching against literals. Not true. Pattern-matching literals explicitly avoids any

Re: [Haskell-cafe] GSoC Project Proposal: Markdown support for Haddock

2013-04-08 Thread Roman Cheplyaka
inside the comments are rather exotic. On the other hand, the liberty to write whatever one wants inside a comment feels important to me. On 7 Apr 2013, at 22:12, Roman Cheplyaka wrote: Looks like a bug in cpphs to me (CC'ing Malcolm). It should respect comments. E.g. GNU cpp strips C comments

Re: [Haskell-cafe] GSoC Project Proposal: Markdown support for Haddock

2013-04-08 Thread Roman Cheplyaka
* Ivan Lazar Miljenovic ivan.miljeno...@gmail.com [2013-04-08 10:18:32+1000] On 8 April 2013 07:12, Roman Cheplyaka r...@ro-che.info wrote: Looks like a bug in cpphs to me (CC'ing Malcolm). It should respect comments. E.g. GNU cpp strips C comments. Not quite: http://hackage.haskell.org

Re: [Haskell-cafe] Prolog-style patterns

2013-04-08 Thread Roman Cheplyaka
* Conal Elliott co...@conal.net [2013-04-08 07:06:17-0700] What you're suggesting is called non-linear patterns, and it's a perfectly sensible, well-defined feature in a language with pattern-matching. One issue with it in Haskell is that it'd lead to inconsistent semantics: myEq x x = True

Re: [Haskell-cafe] GSoC Project Proposal: Markdown support for Haddock

2013-04-07 Thread Roman Cheplyaka
Looks like a bug in cpphs to me (CC'ing Malcolm). It should respect comments. E.g. GNU cpp strips C comments. Roman * John MacFarlane j...@berkeley.edu [2013-04-05 16:04:32-0700] I like markdown and use it all the time. While I acknowledge the problems that have been pointed out, markdown has

Re: [Haskell-cafe] meaning of referential transparency

2013-04-06 Thread Roman Cheplyaka
* Henning Thielemann lemm...@henning-thielemann.de [2013-04-06 19:43:45+0200] Can someone enlighten me about the origin of the term referential transparency? I can lookup the definition of referential transparency in the functional programming sense in the Haskell Wiki and I can lookup the

Re: [Haskell-cafe] Is there an escape from MonadState+MonadIO+MonadError monad stack?

2013-04-06 Thread Roman Cheplyaka
Hi Ömer, You forgot to mention what your problem is. :) What you describe sounds reasonable. Why do you want to escape? Roman * Ömer Sinan Ağacan omeraga...@gmail.com [2013-04-07 00:22:58+0300] Hi, I'm a hobbyist Haskell programmer and my use of Haskell is mostly consists of writing

Re: [Haskell-cafe] Optimizing Fold Expressions

2013-03-30 Thread Roman Cheplyaka
The solution to this problem is called scrap your boilerplate. There are a few libraries that implement it, in different variations. Let me show you how to do it using my library, 'traverse-with-class'. You'll need install it and the 'tagged' package to run this example. {-# LANGUAGE

Re: ImplicitParams and MonoLocalBinds

2013-03-29 Thread Roman Cheplyaka
) -Iavor On Fri, Mar 22, 2013 at 1:39 AM, Roman Cheplyaka r...@ro-che.info wrote: The value of the following expression let ?y = 2 in let p = ?y in let ?y = 1 in p depends on whether the second binding is generalised. MonomorphismRestriction makes

Re: [Haskell-cafe] Parsec community and up-to-date documentation

2013-03-25 Thread Roman Cheplyaka
* Konstantine Rybnikov k...@k-bx.com [2013-03-25 00:19:04+0200] Hi! I've been busy with (trying to) learning/using parsec lately and as a beginner had a lot of headache starting from outdated documentation in various places, lack of more tutorials, confusion between Text.Parsec and

Re: [Haskell-cafe] Parsec community and up-to-date documentation

2013-03-25 Thread Roman Cheplyaka
* Konstantine Rybnikov k...@k-bx.com [2013-03-25 11:22:21+0200] On Mon, Mar 25, 2013 at 8:49 AM, Roman Cheplyaka r...@ro-che.info wrote: * Konstantine Rybnikov k...@k-bx.com [2013-03-25 00:19:04+0200] Hi! I've been busy with (trying to) learning/using parsec lately

[Haskell-cafe] Data.StorableVector vs Data.Vector.Storable

2013-03-24 Thread Roman Cheplyaka
What is the relationship between these two modules? Do we really need both? (Data.Vector.Storable is part of vector, Data.StorableVector is from a separate package, storablevector.) Roman ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: Polymorphic implicit parameters

2013-03-21 Thread Roman Cheplyaka
Message- | From: glasgow-haskell-users-boun...@haskell.org [mailto:glasgow-haskell-users- | boun...@haskell.org] On Behalf Of Roman Cheplyaka | Sent: 20 March 2013 08:58 | To: glasgow-haskell-users@haskell.org | Subject: Polymorphic implicit parameters | | I'm curious as to why GHC

Polymorphic implicit parameters

2013-03-20 Thread Roman Cheplyaka
I'm curious as to why GHC doesn't accept the following (contrived) module: {-# LANGUAGE ImplicitParams, RankNTypes #-} f :: (?g :: (forall a . a - a)) = a - a f = ?g The error message is: Illegal polymorphic or qualified type: forall a. a - a In the type signature for `f': f ::

Re: [Haskell-cafe] MVar which can not be null ?

2013-03-18 Thread Roman Cheplyaka
* s9gf4ult s9gf4...@gmail.com [2013-03-18 13:07:04+0600] Hello, I am looking for MVar which can not be null. I need some kind of thread save atomic IO operation like I can do with modifyMVar, but I want this variable always contain some value and never be null. Thanks. Wrap it into a

Re: [Haskell-cafe] attoparsec and backtracking

2013-03-16 Thread Roman Cheplyaka
* Niklas Hambüchen m...@nh2.me [2013-03-16 03:49:29+] I would agree that what attoparsec does for | of Alternative and mplus for MonadPlus is correct since e.g. the mplus laws say that a failure must be identity and therefore the following alternatives must be considered. I also find it

Re: [Haskell-cafe] Optimization flag changing result of code execution

2013-03-16 Thread Roman Cheplyaka
Perhaps the problem is in withSystemRandom, which uses unsafePerformIO? Does the problem persist if you seed your program with some predefined seed? Roman * Azeem -ul-Hasan aze...@live.com [2013-03-16 13:46:54+0500] Hi Carter, Thank you for your help, but I can confirm that this is

Re: [Haskell-cafe] Are there any reasons against using ~ when matching one-constructor data types?

2013-03-13 Thread Roman Cheplyaka
* Petr Pudlák petr@gmail.com [2013-03-13 16:32:45+0100] If I define a function that matches on a single-constructor data type, such as (,), is there any reason against using ~? Like f (a,b) = ... instead of f ~(a,b) = ... ? I've seen that not using ~ can lead to problems

[Haskell-cafe] newtype a Constraint?

2013-03-12 Thread Roman Cheplyaka
Is there a way to newtype a constraint? Imagine a type class parameterised over constraints. What do I do if I want multiple instances for (essentially) the same constraint? Roman ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] newtype a Constraint?

2013-03-12 Thread Roman Cheplyaka
, like you do with data newtypes. On Tue, Mar 12, 2013 at 2:18 PM, Roman Cheplyaka r...@ro-che.info wrote: Is there a way to newtype a constraint? Imagine a type class parameterised over constraints. What do I do if I want multiple instances for (essentially) the same constraint

Re: [Haskell-cafe] What pattern is this (Something.T - IO a) in Sound.ALSA.Sequencer

2013-03-05 Thread Roman Cheplyaka
* Martin Drautzburg martin.drautzb...@web.de [2013-03-04 21:21:30+0100] On Sunday, 3. March 2013 21:11:21 Roman Cheplyaka wrote: Admittedly, programming with callbacks is not very pleasant. So we have an excellent alternative — the continuation monad transformer! This nested code

Re: [Haskell-cafe] What pattern is this (Something.T - IO a) in Sound.ALSA.Sequencer

2013-03-03 Thread Roman Cheplyaka
Hi Martin, These are called continuations or callbacks. In this case, the term callback seems to fit better, since the result of continuation is an IO action. The common use case for callbacks is when you want to release some resources after the IO action completes. Let's look at the definition

Re: [Haskell-cafe] Parser left recursion

2013-03-02 Thread Roman Cheplyaka
You can find our experiments here: https://github.com/feuerbach/hagll But don't set your expectations high :-) Roman * Paul Callaghan paulcc@gmail.com [2013-03-01 06:27:46+] Hi Another alternative is this Haskell library: https://github.com/paulcc/xsaiga This is a combinator

[Haskell-cafe] Problem accessing Hackage

2013-02-28 Thread Roman Cheplyaka
I have this weird problem accessing hackage, when the first response gets delayed by 30 seconds: http://superuser.com/q/557271/53951 Does anyone else experience it? (No need to reply with works for me — I know that it works for most people.) Any clues about what can be the problem? Roman

Re: [Haskell-cafe] Problem accessing Hackage

2013-02-28 Thread Roman Cheplyaka
lookup on the client's IP address? - is it really necessary? I'll try to convince my ISP to fix their DNS, but I'm not sure I'll succeed, and there may be other people affected by this. Roman * Roman Cheplyaka r...@ro-che.info [2013-02-28 10:49:04+0200] I have this weird problem accessing hackage

Re: base package -- goals

2013-02-25 Thread Roman Cheplyaka
* Stephen Paul Weber singpol...@singpolyma.net [2013-02-25 11:29:42-0500] Why shouldn't Prelude (and other really stable, standard modules) just live in the `haskell2010` package? Because then we can't make changes to it without producing a new language standard. Roman

Re: [Haskell-cafe] RFC: rewrite-with-location proposal

2013-02-25 Thread Roman Cheplyaka
* Petr Pudlák petr@gmail.com [2013-02-25 14:02:28+0100] 2013/2/25 Michael Snoyman mich...@snoyman.com At that point, we've now made two changes to REWRITE rules: 1. They can takes a new ALWAYS parameters. 2. There's a new, special identifier currentLocation available. What

Re: [Haskell-cafe] Parser left recursion

2013-02-24 Thread Roman Cheplyaka
* Martin Drautzburg martin.drautzb...@web.de [2013-02-24 12:31:37+0100] Twan van Laarhoven told me that: Left-recursion is always a problem for recursive-descend parsers. Note that the left recursion is already visible in the grammar above, no need to convert to parser combinators.

Re: [Haskell-cafe] Parser left recursion

2013-02-24 Thread Roman Cheplyaka
* Kim-Ee Yeoh k...@atamo.com [2013-02-24 19:22:33+0700] On Sun, Feb 24, 2013 at 7:09 PM, Roman Cheplyaka r...@ro-che.info wrote: Thus, your recursion is well-founded — you enter the recursion with the input strictly smaller than you had in the beginning. Perhaps you meant /productive

Re: [Haskell-cafe] Parser left recursion

2013-02-24 Thread Roman Cheplyaka
* Kim-Ee Yeoh k...@atamo.com [2013-02-24 19:22:33+0700] On Sun, Feb 24, 2013 at 7:09 PM, Roman Cheplyaka r...@ro-che.info wrote: Thus, your recursion is well-founded — you enter the recursion with the input strictly smaller than you had in the beginning. Perhaps you meant /productive

Re: [Haskell-cafe] Parser left recursion

2013-02-24 Thread Roman Cheplyaka
* Kim-Ee Yeoh k...@atamo.com [2013-02-24 19:56:13+0700] I was merely thrown off by your mention of well-founded and the assertion that you're left with a strictly smaller input. I don't see any of this. It may become more obvious if you try to write two recursive descent parsers (as recursive

Re: base package

2013-02-23 Thread Roman Cheplyaka
* Simon Peyton-Jones simo...@microsoft.com [2013-02-23 10:27:46+] I believe that the driving goal is: *to allow changes to internals without forcing a version-bump on 'base', on which every package depends This is a good goal. Another goal could be to make the packages more

Re: [Haskell-cafe] generalized, tail-recursive left fold that can

2013-02-21 Thread Roman Cheplyaka
Thanks, I see now where my mistake was. Laziness (or call by name) is needed to make the step from (\e a z - a (f z e)) (head l) (foldr (\e a z - a (f z e)) id (tail l) z) (f z (head l)) to \z - foldr (\e a z - a (f z e)) id (tail l) (f z (head l)) without evaluating foldr

Re: [Haskell-cafe] Parser left recursion

2013-02-20 Thread Roman Cheplyaka
* Tillmann Rendel ren...@informatik.uni-marburg.de [2013-02-20 09:59:47+0100] One way to fix this problem is to refactor the grammar in order to avoid left recursion. So let's distinguish expressions that can start with expressions and expressions that cannot start with expressions: [...]

Re: [Haskell-cafe] Parser left recursion

2013-02-20 Thread Roman Cheplyaka
* Tillmann Rendel ren...@informatik.uni-marburg.de [2013-02-20 12:39:35+0100] Hi, Roman Cheplyaka wrote: Another workaround is to use memoization of some sort — see e.g. GLL (Generalized LL) parsing. Is there a GLL parser combinator library for Haskell? I know about the gll-combinators

[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] 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

Re: [Haskell-cafe] generalized, tail-recursive left fold that can finish tne computation prematurely

2013-02-18 Thread Roman Cheplyaka
* Petr Pudlák petr@gmail.com [2013-02-18 17:10:26+0100] Dear Haskellers, while playing with folds and trying to implement `!!` by folding, I came to the conclusion that: - `foldr` is unsuitable because it counts the elements from the end, while `!!` needs counting from the start (and

Re: [Haskell-cafe] generalized, tail-recursive left fold that can finish tne computation prematurely

2013-02-18 Thread Roman Cheplyaka
* Roman Cheplyaka r...@ro-che.info [2013-02-18 18:28:47+0200] * Petr Pudlák petr@gmail.com [2013-02-18 17:10:26+0100] Dear Haskellers, while playing with folds and trying to implement `!!` by folding, I came to the conclusion that: - `foldr` is unsuitable because it counts

Re: [Haskell-cafe] generalized, tail-recursive left fold that can finish tne computation prematurely

2013-02-18 Thread Roman Cheplyaka
* o...@okmij.org o...@okmij.org [2013-02-19 06:27:10-] As others have pointed out, _in principle_, foldr is not at all deficient. We can, for example, express foldl via foldr. Moreover, we can express head, tail, take, drop and even zipWith through foldr. That is, the entire list

[Haskell-cafe] MonadReader laws

2013-02-17 Thread Roman Cheplyaka
Has anyone formulated a reasonable set of laws for MonadReader? The instances for continuation-based monad transformers contradict any intuition about local and ask. E.g. for LogicT: flip runReader 1 $ observeAllT $ local (const 2) ask [1] flip runReader 1 $ observeAllT $ local (const

base package (was: GHC 7.8 release?)

2013-02-13 Thread Roman Cheplyaka
* Simon Marlow marlo...@gmail.com [2013-02-13 09:00:15+] It's feasible to split base, but to a first approximation what you end up with is base renamed to ghc-base, and then the new base contains just stub modules that re-export stuff from ghc-base. It would be great to have a portable

Re: [Haskell-cafe] Control.Monad provisional?

2013-02-11 Thread Roman Cheplyaka
Alfredo is right. Most users don't pay much attention to it, and developers have preferred to be conservative and mark the modules as experimental (and provisional at best), because there's no incentive to commit to keeping the modules stable. And there's no policy about stable modules. The

Re: GHC 7.8 release?

2013-02-10 Thread Roman Cheplyaka
* Manuel M T Chakravarty c...@cse.unsw.edu.au [2013-02-10 21:17:07+1100] Re (2): we should encourage contributors to fork the GHC repos on GitHub and work in those. That makes it easy for everybody to build forks (which will be longer-lived under the above policy) and creating a fork doesn't

Re: [Haskell-cafe] CoArbitrary

2013-02-09 Thread Roman Cheplyaka
I don't think the question was about generating functions... FWIW, both QuickCheck and SmallCheck generate functions. There was also an interesting paper at the last ICFP by Koen related to this. But I think Tony is looking for some kind of a pattern here... Roman * Stephen Tetley

Re: GHC 7.8 release?

2013-02-07 Thread Roman Cheplyaka
* Simon Peyton-Jones simo...@microsoft.com [2013-02-07 08:25:10+] So another alternative is to leave it all as HEAD, and wait another few months before making a release. You can still use all the new stuff by compiling HEAD, or grabbing a snapshot distribution. And it makes it hard for

Re: [Haskell-cafe] Parsec Vs. src exts

2013-02-03 Thread Roman Cheplyaka
* Patrick Pelletier c...@funwithsoftware.org [2013-02-03 10:57:14-0800] On 2/3/13 12:27 AM, Stephen Tetley wrote: Haskell-src-exts parses real Haskell - including most (if not all?) GHC extensions. If you were wanting to analyze 'in the wild' Haskell projects you might also want to use CPPHS

Re: [Haskell-cafe] Parsec Vs. src exts

2013-02-02 Thread Roman Cheplyaka
Hi Sean, 1. Please do not confuse haskell-src and haskell-src-exts. You should definitely use the latter. I also find it relatively well documented. 2. If your goal is to write a tool and not to write a Haskell parser as an exercise, then I would recommend haskell-src-exts. Another option

[Haskell-cafe] GHC.Generics and newtypes

2013-01-27 Thread Roman Cheplyaka
Hi, Is it possible to generate different instances for newtypes and datatypes using GHC.Generics? Roman ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] GHC.Generics and newtypes

2013-01-27 Thread Roman Cheplyaka
through newtypes. Cheers, Pedro On Sun, Jan 27, 2013 at 8:17 PM, Roman Cheplyaka r...@ro-che.info wrote: Hi, Is it possible to generate different instances for newtypes and datatypes using GHC.Generics? Roman ___ Haskell-Cafe

Re: [Haskell-cafe] GHC.Generics and newtypes

2013-01-27 Thread Roman Cheplyaka
request? Cheers, Pedro On Sun, Jan 27, 2013 at 8:34 PM, Roman Cheplyaka r...@ro-che.info wrote: Sorry, I wasn't clear. What I want is somehow to find out whether the type under consideration is declared using data or newtype. Is it possible? Roman * José Pedro Magalhães j

Re: [Haskell-cafe] catamorphisms and attribute grammars

2013-01-26 Thread Roman Cheplyaka
* Petr P petr@gmail.com [2013-01-26 23:03:51+0100] Dear Haskellers, I read some stuff about attribute grammars recently [1] and how UUAGC [2] can be used for code generation. I felt like this should be possible inside Haskell too so I did some experiments and I realized that indeed

Re: [Haskell-cafe] catamorphisms and attribute grammars

2013-01-26 Thread Roman Cheplyaka
Hi Chris, While the two things solve similar problems and have other similarities, they are still quite different. It's hard to call Petr's type a machine — there's no dynamics in it. It's just a pair of an f-algebra and finalizer. Values of your type return themselves — it is exactly this

Re: [Haskell-cafe] Manually instantiating Typeable w/DataKinds

2013-01-24 Thread Roman Cheplyaka
Hi Uri, Here's how it might look. {-# LANGUAGE DeriveDataTypeable, DataKinds, KindSignatures, ScopedTypeVariables #-} module Example where import Data.Typeable import Data.Proxy data Tag = TagV | TagE | TagA | TagL deriving Typeable class TypeableTag (t :: Tag) where

[Haskell-cafe] Non-derivable Typeable

2013-01-22 Thread Roman Cheplyaka
I need to declare a Typeable instance for a type which has an argument of kind * - *. GHC refuses to derive it. What is a recommended way to go about it? In particular, if I write the instance by hand, how important is the fingerprint, and how could I generate it? Roman

<    1   2   3   4   5   6   >