[Haskell-cafe] Monad.Reader #20 call for copy

2012-01-04 Thread Edward Z. Yang
I'm pleased to announce that I, Edward Z. Yang, will be taking over Brent Yorgey's role as lead editor of the Monad Reader! Call for Copy: The Monad.Reader - Issue 20 Whether you're an established academic or have only just started learning Haskell, if

Re: [Haskell-cafe] Experiments in Haskell Packaging

2012-01-04 Thread Sanket Agrawal
Hi Chris, Is it possible to also make the GHC and haskell platform distributions available as relocatable rpms, instead of HUB packaging? The reason is that for some of us, when we work in complex production environment which has its own deployment procedures, we have to deploy it differently. A h

Re: [Haskell-cafe] buildDepends syntax and checks

2012-01-04 Thread Rogan Creswick
On Wed, Jan 4, 2012 at 2:29 AM, Shakthi Kannan wrote: > > #2 Is there a way to cross-check if the defined dependencies are in > fact correct, or is it left to the package owner to write them? > Generally speaking, this is undecidable (if I remember my complexity classes correctly...). The semant

Re: [Haskell-cafe] How to split this string.

2012-01-04 Thread AUGER Cédric
Le Wed, 04 Jan 2012 17:49:15 +, Steve Horne a écrit : > On 04/01/2012 16:47, Steve Horne wrote: > > > > (a == a) > > reflexivity : (a == b) => (b == a) > > transitivity : (a == b) && (b == c) => (a == c) > > > Oops - that's... > > reflexivity : (a == a) > symmetry : (a == b) => (b ==

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread AUGER Cédric
Le Wed, 4 Jan 2012 20:13:34 +0100, Yves Parès a écrit : > > f :: forall a. (forall b. b -> b) -> a -> a > > f id x = id x > > > is very similar to the first case, x is still universally > > quantified (a) and there is an existential quantification in id (b). > > I don't get it. What is 'id' exi

[Haskell-cafe] Composing analyses.

2012-01-04 Thread Serguey Zefirov
I am trying to create a stack of analyses. There are basic analyses then there are derived analyses that create a DAG of analyses. I thought I can express their relationship through type classes, but I failed. I've attached the source of my failure. Main points are below: getAnalysisResult :: Ena

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread Yves Parès
> f :: forall a. (forall b. b -> b) -> a -> a > f id x = id x > is very similar to the first case, x is still universally quantified (a) > and there is an existential quantification in id (b). I don't get it. What is 'id' existentially quantified in? f calls id so f will decide what will be its t

Re: [Haskell-cafe] How to split this string.

2012-01-04 Thread Christian Maeder
Am 04.01.2012 17:47, schrieb Steve Horne: On 02/01/2012 11:12, Jon Fairbairn wrote: max writes: I want to write a function whose behavior is as follows: foo "string1\nstring2\r\nstring3\nstring4" = ["string1", "string2\r\nstring3", "string4"] Note the sequence "\r\n", which is ignored. How c

Re: [Haskell-cafe] How to split this string.

2012-01-04 Thread Steve Horne
On 04/01/2012 16:47, Steve Horne wrote: (a == a) reflexivity : (a == b) => (b == a) transitivity : (a == b) && (b == c) => (a == c) Oops - that's... reflexivity : (a == a) symmetry : (a == b) => (b == a) transitivity : (a == b) && (b == c) => (a == c) An equivalence relation is a rela

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread AUGER Cédric
Le Wed, 4 Jan 2012 16:22:31 +0100, Yves Parès a écrit : > Oleg explained why those work in his last post. It's the exact same > logic for each one. > > > f :: a -> a > > f x = x :: a > > We explained that too: it's converted (alpha-converted, but I don't > exactly know what 'alpha' refers to. I

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread AUGER Cédric
Le Wed, 4 Jan 2012 14:41:21 +0100, Yves Parès a écrit : > > I expected the type of 'x' to be universally quantified, and thus > > can be unified with 'forall a. a' with no problem > > As I get it. 'x' is not universally quantified. f is. [1] > x would be universally quantified if the type of f w

Re: [Haskell-cafe] How to split this string.

2012-01-04 Thread Steve Horne
On 02/01/2012 11:12, Jon Fairbairn wrote: max writes: I want to write a function whose behavior is as follows: foo "string1\nstring2\r\nstring3\nstring4" = ["string1", "string2\r\nstring3", "string4"] Note the sequence "\r\n", which is ignored. How can I do this? cabal install split then d

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread Thiago Negri
Got it. Thanks. :) The gotcha for me is that I was thinking as "a generic type 'a' that I may " and not in terms "if something is typed a generic 'a', then it must fit in ANY type". I think this is a common mistake, as I did read about it more than once. I.e., undefined :: a means a value that c

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread Antoine Latter
On Wed, Jan 4, 2012 at 9:08 AM, Thiago Negri wrote: > Do not compile: > > f :: a -> a > f x = x :: a > >    Couldn't match type `a' with `a1' >      `a' is a rigid type variable bound by >          the type signature for f :: a -> a at C:\teste.hs:4:1 >      `a1' is a rigid type variable bound by

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread Yves Parès
Oleg explained why those work in his last post. It's the exact same logic for each one. > f :: a -> a > f x = x :: a We explained that too: it's converted (alpha-converted, but I don't exactly know what 'alpha' refers to. I guess it's phase the type inferer goes through) to: f :: forall a. a ->

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread Thiago Negri
Do not compile: f :: a -> a f x = x :: a Couldn't match type `a' with `a1' `a' is a rigid type variable bound by the type signature for f :: a -> a at C:\teste.hs:4:1 `a1' is a rigid type variable bound by an expression type signature: a1 at C:\teste.hs:4:7

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread Yves Parès
> I don't see the point in universally quantifying over types which are already present in the environment I think it reduces the indeterminacy you come across when you read your program ("where does this type variable come from, btw?") > So is there anyway to "force" the scoping of variables, so

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread AUGER Cédric
So is there anyway to "force" the scoping of variables, so that f :: a -> a f x = x :: a becomes valid? Do we need to do it the Ocaml way, that is not declaring the first line, activate XScopedVariables and do: f :: a -> a = \x -> x :: a or f (x :: a) = x :: a or some other thing ? I don't see

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread Brandon Allbery
On Wed, Jan 4, 2012 at 08:41, Yves Parès wrote: > Would you try: > > f :: a -> a > f x = undefined :: a > > And tell me if it works? IMO it doesn't. It won't; a will be a new type variable unrelated to the one in the signature, in the absence of ScopedTypeVariables and an explicit forall in the

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread Yves Parès
Yes but as I understood it the type inferer was taking your type annotation for granted, and apparently in fact it re-specifies it. What you said was in reality: > f :: forall. a -> a > f x = undefined :: forall a1. a1 And it turned it into: f :: forall. a -> a f x = undefined :: a (here, 'a' would

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread oleg
One should keep in mind the distinction between schematic variables (which participate in unification) and universally quantified variables. Let's look at the forall-elimination rule G |- e : forall a. A E G |- e : A[a := t] If the term e has the typ

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread Yucheng Zhang
On Wed, Jan 4, 2012 at 9:41 PM, Yves Parès wrote: > Would you try: > > f :: a -> a > f x = undefined :: a > > And tell me if it works? IMO it doesn't. It works. As I understand, in this situation we are specializing the 'undefined :: forall a. a' to a more specific dependent type. _

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread Yves Parès
> I expected the type of 'x' to be universally quantified, and thus can be > unified with 'forall a. a' with no problem As I get it. 'x' is not universally quantified. f is. [1] x would be universally quantified if the type of f was : f :: (forall a. a) -> (forall a. a) [1] Yet here I'm not sure

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread Yucheng Zhang
On Wed, Jan 4, 2012 at 8:15 PM, Yucheng Zhang wrote: > I expected the type of 'x' to be universally quantified, and thus can be > unified > with 'forall a. a' with no problem. I've never been thinking in a detailed level, and the 'x' appears to be able to take any type, and thus the wrong expect

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread Yucheng Zhang
On Wed, Jan 4, 2012 at 7:58 PM, Yves Parès wrote: > f :: forall a. a -> a > f x = x :: forall a. a > > Which is obviously wrong: when you have entered f, x has been instatiated to > a specific type 'a', and then you want it to x to be of any type? That > doesn't make sense. I did not expect the t

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread Yves Parès
> f :: a -> a > f x = x :: a -- invalid Perfect example indeed. > The confusing point to me is that the 'a' from 'f' type signature on > its own is not universally quantified as I expected, > and it is dependent on the type of 'f'. > This dependence is not obvious for a beginner like me. It's

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread Yucheng Zhang
On Wed, Jan 4, 2012 at 3:46 AM, Yves Parès wrote: > Because without ScopedTypeVariable, both types got expanded to : > > legSome :: forall nt t s. LegGram nt t s -> nt -> Either String ([t], s) > > subsome :: forall nt t s. [RRule nt t s] ->  Either String ([t], s) > > So you see subsome declare n

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread Yves Parès
> Ocaml community (where most people strongly rely on type inference > and do not put types very often) Well it's the same for Haskell. > foo :: bar -> foobar -> barfoo > foo b = let *fooAux :: foobar -> barfoo* -- You can comment it out >fooAux fb = if f b fb >

Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-04 Thread AUGER Cédric
Le Tue, 3 Jan 2012 20:46:15 +0100, Yves Parès a écrit : > > Actually, my question is why the different type can't be unified > > with the > inferred type? > > Because without ScopedTypeVariable, both types got expanded to : > > legSome :: *forall nt* t s. LegGram nt t s -> nt -> Either String >

[Haskell-cafe] buildDepends syntax and checks

2012-01-04 Thread Shakthi Kannan
Hi, #1 I would like to know if there is any context grammar or syntax for the package dependencies that are allowed in buildDepends in each .cabal file? AnyVersion and WildcardVersion are consistent. But, I see quite a bit of variations in what is included in UnionVersionRange and IntersectVersion