From david.feuer at gmail.com Thu Jan 1 02:30:44 2015 From: david.feuer at gmail.com (David Feuer) Date: Wed, 31 Dec 2014 21:30:44 -0500 Subject: [Haskell-cafe] Proposed change to a couple Data.Tree functions Message-ID: Since you folks seem to know a lot about Data.Tree, I thought maybe you could take a look at https://github.com/haskell/containers/pull/126 and give me your thoughts. Does it look correct? Might it be efficient? David Feuer From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Thu Jan 1 13:24:54 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Thu, 1 Jan 2015 13:24:54 +0000 Subject: [Haskell-cafe] ordNub In-Reply-To: References: <51E28994.4080008@nh2.me> <51E28E0B.8080702@nh2.me> Message-ID: <20150101132454.GH14978@weber> On Mon, Jul 15, 2013 at 11:21:39PM -0400, Clark Gaebel wrote: > As a tangent, can anyone think of a data structure for which you can > write an Ord instance but Hashable/Eq is impossible (or prove > otherwise)? How about the converse? A conversation on #haskell brought back to mind this question, which I'm not sure was ever answered. Is there a type with an Eq instance for which on Ord instance could not also be provided (i.e. I'm interested in Clark's "converse")? One answer is that I could write data A = A deriving Eq and then not export the constructor. That would make it impossible to write an Ord instance. However, I'm more interested in the question "morally" or "in principle". If we think about algebraic datatypes built from sums and products of base types, which have both Eq and Ord, and the function type construct, which prevents both Eq and Ord, it seems that the two always go together, in principle. Am I missing anything more exotic? IORef's have Eq but not Ord. Is there a good reason for that? Would Ord break "referential transparency" somehow? I doubt it. How about STRef? It seems more likely they shouldn't have Ord. Any thoughts? Tom From david.feuer at gmail.com Thu Jan 1 13:42:09 2015 From: david.feuer at gmail.com (David Feuer) Date: Thu, 1 Jan 2015 08:42:09 -0500 Subject: [Haskell-cafe] ordNub In-Reply-To: <51E28994.4080008@nh2.me> References: <51E28994.4080008@nh2.me> Message-ID: I think ordNub in Data.Set, hashNub in Data.HashSet or somewhere, and bitsNub in Data.Bits (for FiniteBits things). On Jul 14, 2013 7:21 AM, "Niklas Hamb?chen" wrote: > tldr: nub is abnormally slow, we shouldn't use it, but we do. > > > As you might know, Data.List.nub is O(n?). (*) > > As you might not know, almost *all* practical Haskell projects use it, > and that in places where an Ord instance is given, e.g. happy, Xmonad, > ghc-mod, Agda, darcs, QuickCheck, yesod, shake, Cabal, haddock, and 600 > more (see https://github.com/nh2/haskell-ordnub). > > I've taken the Ord-based O(n * log n) implementation from yi using a Set: > > ordNub :: (Ord a) => [a] -> [a] > ordNub l = go empty l > where > go _ [] = [] > go s (x:xs) = if x `member` s then go s xs > else x : go (insert x s) xs > > > and put benchmarks on > > http://htmlpreview.github.io/?https://github.com/nh2/haskell-ordnub/blob/1f0a2c94a/report.html > (compare `nub` vs `ordNub`). > > `ordNub` is not only in a different complexity class, but even seems to > perform better than nub for very small numbers of actually different > list elements (that's the numbers before the benchmark names). > > (The benchmark also shows some other potential problem: Using a state > monad to keep the set instead of a function argument can be up to 20 > times slower. Should that happen?) > > What do you think about ordNub? > > I've seen a proposal from 5 years ago about adding a *sort*Nub function > started by Neil, but it just died. > > > (*) The mentioned complexity is for the (very common) worst case, in > which the number of different elements in the list grows with the list > (alias you don't have an N element list with always only 5 different > things inside). > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Thu Jan 1 13:43:29 2015 From: david.feuer at gmail.com (David Feuer) Date: Thu, 1 Jan 2015 08:43:29 -0500 Subject: [Haskell-cafe] ordNub In-Reply-To: References: <51E28994.4080008@nh2.me> Message-ID: Er.. that last might be to hard. But Data.IntSet can support its own nub version. On Jan 1, 2015 8:42 AM, "David Feuer" wrote: > I think ordNub in Data.Set, hashNub in Data.HashSet or somewhere, and > bitsNub in Data.Bits (for FiniteBits things). > On Jul 14, 2013 7:21 AM, "Niklas Hamb?chen" wrote: > >> tldr: nub is abnormally slow, we shouldn't use it, but we do. >> >> >> As you might know, Data.List.nub is O(n?). (*) >> >> As you might not know, almost *all* practical Haskell projects use it, >> and that in places where an Ord instance is given, e.g. happy, Xmonad, >> ghc-mod, Agda, darcs, QuickCheck, yesod, shake, Cabal, haddock, and 600 >> more (see https://github.com/nh2/haskell-ordnub). >> >> I've taken the Ord-based O(n * log n) implementation from yi using a Set: >> >> ordNub :: (Ord a) => [a] -> [a] >> ordNub l = go empty l >> where >> go _ [] = [] >> go s (x:xs) = if x `member` s then go s xs >> else x : go (insert x s) xs >> >> >> and put benchmarks on >> >> http://htmlpreview.github.io/?https://github.com/nh2/haskell-ordnub/blob/1f0a2c94a/report.html >> (compare `nub` vs `ordNub`). >> >> `ordNub` is not only in a different complexity class, but even seems to >> perform better than nub for very small numbers of actually different >> list elements (that's the numbers before the benchmark names). >> >> (The benchmark also shows some other potential problem: Using a state >> monad to keep the set instead of a function argument can be up to 20 >> times slower. Should that happen?) >> >> What do you think about ordNub? >> >> I've seen a proposal from 5 years ago about adding a *sort*Nub function >> started by Neil, but it just died. >> >> >> (*) The mentioned complexity is for the (very common) worst case, in >> which the number of different elements in the list grows with the list >> (alias you don't have an N element list with always only 5 different >> things inside). >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg at okmij.org Thu Jan 1 13:58:35 2015 From: oleg at okmij.org (oleg at okmij.org) Date: Thu, 1 Jan 2015 08:58:35 -0500 (EST) Subject: [Haskell-cafe] ordNub Message-ID: <20150101135835.B8C30C3832@www1.g3.pair.com> Tom Ellis wrote: > Is there a type with an Eq instance for which on Ord instance could not also > be provided (i.e. I'm interested in Clark's "converse")? Of course. One of the very many examples is Complex. One can say we can compare complex numbers, by their absolute value. That is true; however we end up in a position where compare x y returns EQ but x==y returns False. In general, Ord represents total order. There are many structures on which total order cannot be established. Take nodes in the tree, the Tree data type. One can compare nodes by taking a parent to be less than any of its children. But then two brothers are not comparable. Searching for "partial orders" and pre-orders gives many more examples. From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Thu Jan 1 14:04:37 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Thu, 1 Jan 2015 14:04:37 +0000 Subject: [Haskell-cafe] ordNub In-Reply-To: <20150101135835.B8C30C3832@www1.g3.pair.com> References: <20150101135835.B8C30C3832@www1.g3.pair.com> Message-ID: <20150101140436.GJ14978@weber> On Thu, Jan 01, 2015 at 08:58:35AM -0500, oleg at okmij.org wrote: > Tom Ellis wrote: > > Is there a type with an Eq instance for which on Ord instance could not also > > be provided (i.e. I'm interested in Clark's "converse")? > > Of course. One of the very many examples is Complex. One can say we > can compare complex numbers, by their absolute value. That is true; > however we end up in a position where compare x y returns EQ but x==y > returns False. I don't understand your objection. `Complex a` isomorphic to `(a, a)` which can be totally ordered. (The complex field cannot be given a total order *compatible with the field structure*, but that's not relevant to my question.) > In general, Ord represents total order. There are many structures on > which total order cannot be established. Take nodes in the tree, the > Tree data type. One can compare nodes by taking a parent to be less > than any of its children. But then two brothers are not > comparable. Searching for "partial orders" and pre-orders gives many > more examples. I think you may be missing the intent of my question. I am merely asking whether there is a type which supports a (law abiding) Eq instance that cannot support a (law abiding) Ord instance. Whether that Ord instance is compatible with additional structures on that type is beside the point. Tom From atzeus at gmail.com Thu Jan 1 14:12:15 2015 From: atzeus at gmail.com (Atze van der Ploeg) Date: Thu, 1 Jan 2015 15:12:15 +0100 Subject: [Haskell-cafe] ordNub In-Reply-To: <20150101140436.GJ14978@weber> References: <20150101135835.B8C30C3832@www1.g3.pair.com> <20150101140436.GJ14978@weber> Message-ID: Instance Ord a where _ <= _ = True Is law abiding for any type. So there is no type that cannot support a law abiding Ord instance. On Jan 1, 2015 3:04 PM, "Tom Ellis" < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote: > On Thu, Jan 01, 2015 at 08:58:35AM -0500, oleg at okmij.org wrote: > > Tom Ellis wrote: > > > Is there a type with an Eq instance for which on Ord instance could > not also > > > be provided (i.e. I'm interested in Clark's "converse")? > > > > Of course. One of the very many examples is Complex. One can say we > > can compare complex numbers, by their absolute value. That is true; > > however we end up in a position where compare x y returns EQ but x==y > > returns False. > > I don't understand your objection. `Complex a` isomorphic to `(a, a)` > which > can be totally ordered. (The complex field cannot be given a total order > *compatible with the field structure*, but that's not relevant to my > question.) > > > In general, Ord represents total order. There are many structures on > > which total order cannot be established. Take nodes in the tree, the > > Tree data type. One can compare nodes by taking a parent to be less > > than any of its children. But then two brothers are not > > comparable. Searching for "partial orders" and pre-orders gives many > > more examples. > > I think you may be missing the intent of my question. I am merely asking > whether there is a type which supports a (law abiding) Eq instance that > cannot support a (law abiding) Ord instance. Whether that Ord instance is > compatible with additional structures on that type is beside the point. > > Tom > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Thu Jan 1 14:14:16 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Thu, 1 Jan 2015 14:14:16 +0000 Subject: [Haskell-cafe] ordNub In-Reply-To: References: <20150101135835.B8C30C3832@www1.g3.pair.com> <20150101140436.GJ14978@weber> Message-ID: <20150101141416.GK14978@weber> On Thu, Jan 01, 2015 at 03:12:15PM +0100, Atze van der Ploeg wrote: > Instance Ord a where > _ <= _ = True > > Is law abiding for any type. So there is no type that cannot support a law > abiding Ord instance. So let me clarify that I want (<=) to be a total order in the sense that it is * reflexive * symmetric * transitive and `(x <= y) && (y <= x)` implies that `x == y`. Tom From atzeus at gmail.com Thu Jan 1 14:17:13 2015 From: atzeus at gmail.com (Atze van der Ploeg) Date: Thu, 1 Jan 2015 15:17:13 +0100 Subject: [Haskell-cafe] ordNub In-Reply-To: <20150101141416.GK14978@weber> References: <20150101135835.B8C30C3832@www1.g3.pair.com> <20150101140436.GJ14978@weber> <20150101141416.GK14978@weber> Message-ID: Taking Instance Eq a where _ == _ = True Then it has all the properties you mentoined On Jan 1, 2015 3:14 PM, "Tom Ellis" < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote: > On Thu, Jan 01, 2015 at 03:12:15PM +0100, Atze van der Ploeg wrote: > > Instance Ord a where > > _ <= _ = True > > > > Is law abiding for any type. So there is no type that cannot support a > law > > abiding Ord instance. > > So let me clarify that I want (<=) to be a total order in the sense that it > is > > * reflexive > * symmetric > * transitive > > and `(x <= y) && (y <= x)` implies that `x == y`. > > Tom > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Thu Jan 1 14:18:15 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Thu, 1 Jan 2015 14:18:15 +0000 Subject: [Haskell-cafe] ordNub In-Reply-To: <20150101141416.GK14978@weber> References: <20150101135835.B8C30C3832@www1.g3.pair.com> <20150101140436.GJ14978@weber> <20150101141416.GK14978@weber> Message-ID: <20150101141815.GL14978@weber> On Thu, Jan 01, 2015 at 02:14:16PM +0000, Tom Ellis wrote: > So let me clarify that I want (<=) to be a total order in the sense that it > is > > * reflexive > * symmetric > * transitive > > and `(x <= y) && (y <= x)` implies that `x == y`. (*) Correction: I mean "antisymmetric" not "symmetric". Anti-symmetry is exactly this condition (*). Futhermore I want (==) to be at least as fine-grained as extensional equivalence. Tom From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Thu Jan 1 14:19:07 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Thu, 1 Jan 2015 14:19:07 +0000 Subject: [Haskell-cafe] ordNub In-Reply-To: References: <20150101135835.B8C30C3832@www1.g3.pair.com> <20150101140436.GJ14978@weber> <20150101141416.GK14978@weber> Message-ID: <20150101141907.GM14978@weber> On Thu, Jan 01, 2015 at 03:17:13PM +0100, Atze van der Ploeg wrote: > Taking > > Instance Eq a where > _ == _ = True > > Then it has all the properties you mentoined Right, hence my latest clarification that "Futhermore I want (==) to be at least as fine-grained as extensional equivalence.". From atzeus at gmail.com Thu Jan 1 14:22:55 2015 From: atzeus at gmail.com (Atze van der Ploeg) Date: Thu, 1 Jan 2015 15:22:55 +0100 Subject: [Haskell-cafe] ordNub In-Reply-To: <20150101141907.GM14978@weber> References: <20150101135835.B8C30C3832@www1.g3.pair.com> <20150101140436.GJ14978@weber> <20150101141416.GK14978@weber> <20150101141907.GM14978@weber> Message-ID: > i want it to be at least as fine grained as extensional equivalence Then see Oleg's comment or am i missing something here? On Jan 1, 2015 3:19 PM, "Tom Ellis" < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote: > On Thu, Jan 01, 2015 at 03:17:13PM +0100, Atze van der Ploeg wrote: > > Taking > > > > Instance Eq a where > > _ == _ = True > > > > Then it has all the properties you mentoined > > Right, hence my latest clarification that "Futhermore I want (==) to be at > least as fine-grained as extensional equivalence.". > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Thu Jan 1 14:26:53 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Thu, 1 Jan 2015 14:26:53 +0000 Subject: [Haskell-cafe] ordNub In-Reply-To: References: <20150101135835.B8C30C3832@www1.g3.pair.com> <20150101140436.GJ14978@weber> <20150101141416.GK14978@weber> <20150101141907.GM14978@weber> Message-ID: <20150101142653.GN14978@weber> On Thu, Jan 01, 2015 at 03:22:55PM +0100, Atze van der Ploeg wrote: > > i want it to be at least as fine grained as extensional equivalence > > Then see Oleg's comment or am i missing something here? Perhaps you could explain Oleg's comment. I don't understand it. From atzeus at gmail.com Thu Jan 1 14:37:09 2015 From: atzeus at gmail.com (Atze van der Ploeg) Date: Thu, 1 Jan 2015 15:37:09 +0100 Subject: [Haskell-cafe] ordNub In-Reply-To: <20150101142653.GN14978@weber> References: <20150101135835.B8C30C3832@www1.g3.pair.com> <20150101140436.GJ14978@weber> <20150101141416.GK14978@weber> <20150101141907.GM14978@weber> <20150101142653.GN14978@weber> Message-ID: Your question is if I understand correctly, whether we can think of a type that has a law abiding Eq instance that gives equality as fine grained as extensional equality (meaning structural equality?) but for which no law abing instance of Ord can be given such that a <= b && a >= b ==> a == b This boils down to the question whether on each set with an equality relation defined on it a total ordering (consistent with the equality relation) can also be defined. One counterexample is the complex numbers. Does that answer your question? Cheers! On Jan 1, 2015 3:27 PM, "Tom Ellis" < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote: > On Thu, Jan 01, 2015 at 03:22:55PM +0100, Atze van der Ploeg wrote: > > > i want it to be at least as fine grained as extensional equivalence > > > > Then see Oleg's comment or am i missing something here? > > Perhaps you could explain Oleg's comment. I don't understand it. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Thu Jan 1 14:39:59 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Thu, 1 Jan 2015 14:39:59 +0000 Subject: [Haskell-cafe] ordNub In-Reply-To: References: <20150101135835.B8C30C3832@www1.g3.pair.com> <20150101140436.GJ14978@weber> <20150101141416.GK14978@weber> <20150101141907.GM14978@weber> <20150101142653.GN14978@weber> Message-ID: <20150101143959.GO14978@weber> On Thu, Jan 01, 2015 at 03:37:09PM +0100, Atze van der Ploeg wrote: > This boils down to the question whether on each set with an equality > relation defined on it a total ordering (consistent with the equality > relation) can also be defined. I agree with the essence of this restatement. > One counterexample is the complex numbers. This is what I don't understand. The complex numbers can be totally ordered. (Not in a way compatible with the field structure, but that's beside the point). From atzeus at gmail.com Thu Jan 1 14:52:26 2015 From: atzeus at gmail.com (Atze van der Ploeg) Date: Thu, 1 Jan 2015 15:52:26 +0100 Subject: [Haskell-cafe] ordNub In-Reply-To: <20150101143959.GO14978@weber> References: <20150101135835.B8C30C3832@www1.g3.pair.com> <20150101140436.GJ14978@weber> <20150101141416.GK14978@weber> <20150101141907.GM14978@weber> <20150101142653.GN14978@weber> <20150101143959.GO14978@weber> Message-ID: If we do not require that (a <= b) && (a >= b) ==> a == b (where <= is from the total ordering and == is from the equality relation) then it is trivial, take the total ordering forall x y. x <= y that i mentioned earlier. So the compatiblity with equality (you say field structure) is not besides the point, in fact antisymmetry means that the ordering corresponds to the equality relation. Clear now or did I misunderstand? Cheers 2015-01-01 15:39 GMT+01:00 Tom Ellis < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk>: > On Thu, Jan 01, 2015 at 03:37:09PM +0100, Atze van der Ploeg wrote: > > This boils down to the question whether on each set with an equality > > relation defined on it a total ordering (consistent with the equality > > relation) can also be defined. > > I agree with the essence of this restatement. > > > One counterexample is the complex numbers. > > This is what I don't understand. The complex numbers can be totally > ordered. (Not in a way compatible with the field structure, but that's > beside the point). > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Thu Jan 1 15:01:55 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Thu, 1 Jan 2015 15:01:55 +0000 Subject: [Haskell-cafe] ordNub In-Reply-To: References: <20150101140436.GJ14978@weber> <20150101141416.GK14978@weber> <20150101141907.GM14978@weber> <20150101142653.GN14978@weber> <20150101143959.GO14978@weber> Message-ID: <20150101150155.GP14978@weber> On Thu, Jan 01, 2015 at 03:52:26PM +0100, Atze van der Ploeg wrote: > If we do not require that (a <= b) && (a >= b) ==> a == b (where <= is > from the total ordering and == is from the equality relation) then it is > trivial, take the total ordering forall x y. x <= y that i mentioned > earlier. > > So the compatiblity with equality (you say field structure) is not besides > the point, in fact antisymmetry means that the ordering corresponds to the > equality relation. > > Clear now or did I misunderstand? Here is my proposed equality and ordering on the complex numbers: data Complex = Complex (Double, Double) deriving (Eq, Ord) Does this violate any of my requested conditions? From roma at ro-che.info Thu Jan 1 15:06:19 2015 From: roma at ro-che.info (Roman Cheplyaka) Date: Thu, 01 Jan 2015 17:06:19 +0200 Subject: [Haskell-cafe] ordNub In-Reply-To: References: <20150101135835.B8C30C3832@www1.g3.pair.com> <20150101140436.GJ14978@weber> <20150101141416.GK14978@weber> <20150101141907.GM14978@weber> <20150101142653.GN14978@weber> <20150101143959.GO14978@weber> Message-ID: <54A5626B.8040000@ro-che.info> You misunderstood. Complex numbers can be ordered in a way that is compatible with the equality ? the lexicographic ordering. (That said, I don't understand why this discussion is relevant at all. The fact that the ordering exists doesn't mean that one would want to declare the Ord instance, like with complex numbers.) On 01/01/15 16:52, Atze van der Ploeg wrote: > If we do not require that (a <= b) && (a >= b) ==> a == b (where <= is > from the total ordering and == is from the equality relation) then it is > trivial, take > the total ordering forall x y. x <= y that i mentioned earlier. > > So the compatiblity with equality (you say field structure) is not > besides the point, in fact > antisymmetry means that the ordering corresponds to the equality relation. > > Clear now or did I misunderstand? > > Cheers > > 2015-01-01 15:39 GMT+01:00 Tom Ellis > >: > > On Thu, Jan 01, 2015 at 03:37:09PM +0100, Atze van der Ploeg wrote: > > This boils down to the question whether on each set with an equality > > relation defined on it a total ordering (consistent with the equality > > relation) can also be defined. > > I agree with the essence of this restatement. > > > One counterexample is the complex numbers. > > This is what I don't understand. The complex numbers can be totally > ordered. (Not in a way compatible with the field structure, but that's > beside the point). From gale at sefer.org Thu Jan 1 15:06:13 2015 From: gale at sefer.org (Yitzchak Gale) Date: Thu, 1 Jan 2015 17:06:13 +0200 Subject: [Haskell-cafe] Negable constraints on boolean normal forms Message-ID: I've been using Oleg Genrus' wonderful boolean-normal-forms library lately, and enjoying it. However, I'm running into some trouble with overly constrained conversions. In theory, it's possible to convert between any of the normal forms without requiring a Negable instance on the value type. But the conversion mechanism in the library routes everything via the Boolean type class, and that ends up slapping a Negable constraint on everything. You can work around that by embedding your value type in the free Negable, conveniently provided by the library. But in practice that causes a lot of trouble. You end up being required to deal with Neg cases in your result type that are actually impossible to occur and make no sense in context. You have to throw bottoms into provably total functions, or write code that produces meaningless results that you promise in human-readable comments will never happen in practice. You also make the code less efficient by requiring extra passes over the data to "verify" that Neg isn't there. It's similar to what happens when you try to use a Monoid where a Semigroup is really needed by bolting on an artificial "empty" constructor. One thing you can do to begin with is to remove the Negable constraints on the NormalForm instances; I don't see that constraint ever being used. But that still doesn't solve the main issue. Perhaps one approach would be to define a Boolean "bi-monoid" class, where a Boolean bi-monoid is a like Boolean algebra except without negation. All of the normal forms are instances of Boolean bi-monoid even without a Negable constraint on the value type. If you then relax the constraints on the methods of CoBoolean and CoBoolean1 to Boolean bi-monoid instead of Boolean, all of the existing conversion implementations work without modification and without requiring the Negable constraint. I'm not sure if that creates other problems for some other use cases of this library though. Any thoughts? Thanks, Yitz From atzeus at gmail.com Thu Jan 1 15:06:34 2015 From: atzeus at gmail.com (Atze van der Ploeg) Date: Thu, 1 Jan 2015 16:06:34 +0100 Subject: [Haskell-cafe] ordNub In-Reply-To: <20150101150155.GP14978@weber> References: <20150101140436.GJ14978@weber> <20150101141416.GK14978@weber> <20150101141907.GM14978@weber> <20150101142653.GN14978@weber> <20150101143959.GO14978@weber> <20150101150155.GP14978@weber> Message-ID: Nope you're right. Indeed uncompatible with the field structure. Now I'm confused :) I now understand your question, but do not immediately know the answer. Anyone? On Jan 1, 2015 4:02 PM, "Tom Ellis" < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote: > On Thu, Jan 01, 2015 at 03:52:26PM +0100, Atze van der Ploeg wrote: > > If we do not require that (a <= b) && (a >= b) ==> a == b (where <= is > > from the total ordering and == is from the equality relation) then it is > > trivial, take the total ordering forall x y. x <= y that i mentioned > > earlier. > > > > So the compatiblity with equality (you say field structure) is not > besides > > the point, in fact antisymmetry means that the ordering corresponds to > the > > equality relation. > > > > Clear now or did I misunderstand? > > Here is my proposed equality and ordering on the complex numbers: > > data Complex = Complex (Double, Double) deriving (Eq, Ord) > > Does this violate any of my requested conditions? > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From atzeus at gmail.com Thu Jan 1 15:31:19 2015 From: atzeus at gmail.com (Atze van der Ploeg) Date: Thu, 1 Jan 2015 16:31:19 +0100 Subject: [Haskell-cafe] ordNub In-Reply-To: References: <20150101140436.GJ14978@weber> <20150101141416.GK14978@weber> <20150101141907.GM14978@weber> <20150101142653.GN14978@weber> <20150101143959.GO14978@weber> <20150101150155.GP14978@weber> Message-ID: > (That said, I don't understand why this discussion is relevant at all. > The fact that the ordering exists doesn't mean that one would want to > declare the Ord instance, like with complex numbers.) It's not relevant, it's just an intellectual exercise. For any set with a equality relation there exists a total order relation on that set consistent with the equality relation. The question is then whether there exists a set with a computable equality relation such that there is no computable total order. I think the following computable function shows that it is always possible (it chooses an order during queries): Maintain a table, initially emtpy As soon as (a <= b) is requested, see if a and b are already in the table (using the computatble equality function) , if so, use their ordering in the table. If an element is not in the table, add it. Hence the table gives a consistent total order (it depends on which ordering queries are requested, but that is not relevant?) 2015-01-01 16:06 GMT+01:00 Atze van der Ploeg : > Nope you're right. Indeed uncompatible with the field structure. Now I'm > confused :) > > I now understand your question, but do not immediately know the answer. > Anyone? > On Jan 1, 2015 4:02 PM, "Tom Ellis" < > tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote: > >> On Thu, Jan 01, 2015 at 03:52:26PM +0100, Atze van der Ploeg wrote: >> > If we do not require that (a <= b) && (a >= b) ==> a == b (where <= is >> > from the total ordering and == is from the equality relation) then it is >> > trivial, take the total ordering forall x y. x <= y that i mentioned >> > earlier. >> > >> > So the compatiblity with equality (you say field structure) is not >> besides >> > the point, in fact antisymmetry means that the ordering corresponds to >> the >> > equality relation. >> > >> > Clear now or did I misunderstand? >> >> Here is my proposed equality and ordering on the complex numbers: >> >> data Complex = Complex (Double, Double) deriving (Eq, Ord) >> >> Does this violate any of my requested conditions? >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From takenobu.hs at gmail.com Thu Jan 1 15:46:55 2015 From: takenobu.hs at gmail.com (Takenobu Tani) Date: Fri, 2 Jan 2015 00:46:55 +0900 Subject: [Haskell-cafe] GHC(STG, Cmm, asm) illustrated for hardware persons In-Reply-To: <20141231190807.GD5496@teal.hq.k1024.org> References: <20141231190807.GD5496@teal.hq.k1024.org> Message-ID: Hi everyone, Thank you for your warm comments and feedback. I'm glad if I can contribute to the community. I'll update based on the feedback. But my work is very slow. Because it's my night and weekend work(fun) ;-) Thank you. Enjoy, Takenobu 2015-01-01 4:08 GMT+09:00 Iustin Pop : > On Thu, Jan 01, 2015 at 12:40:55AM +0900, Takenobu Tani wrote: > > Dear Haskellers, > > > > I love haskell. > > I'm studying and playing around with Haskell, GHC, STG, Cmm, asm... > > > > When I started studying them, I wanted some figures. > > I've not have some mental models because I am a hardware person. > > > > So I am drawing few illustrations for hardware persons. Here is: > > > > GHC(STG,Cmm,asm) illustrated for hardware persons > > http://takenobu-hs.github.io/downloads/haskell_ghc_illustrated.pdf > > https://github.com/takenobu-hs/haskell-ghc-illustrated > > Excellent slides, thank you very much! Learned quite a few things, and > will need to re-read them more in depth after a while :) > > Happy New Year to everyone, > iustin > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From roma at ro-che.info Thu Jan 1 16:37:45 2015 From: roma at ro-che.info (Roman Cheplyaka) Date: Thu, 01 Jan 2015 18:37:45 +0200 Subject: [Haskell-cafe] ordNub In-Reply-To: References: <20150101140436.GJ14978@weber> <20150101141416.GK14978@weber> <20150101141907.GM14978@weber> <20150101142653.GN14978@weber> <20150101143959.GO14978@weber> <20150101150155.GP14978@weber> Message-ID: <54A577D9.3080100@ro-che.info> The set of all values of the type is always enumerable (it's even recursive, since otherwise you wouldn't be able to tell if something is a value or not). Since it's enumerable, you can enumerate all values of that type: v1, v2, v3, ... Take x1 < x2 iff x1 precedes x2 in the above sequence. This is obviously computable. Roman On 01/01/15 17:31, Atze van der Ploeg wrote: >> (That said, I don't understand why this discussion is relevant at all. >> The fact that the ordering exists doesn't mean that one would want to >> declare the Ord instance, like with complex numbers.) > > It's not relevant, it's just an intellectual exercise. > > For any set with a equality relation there exists a total order relation > on that set consistent with the equality relation. The question is then > whether there exists a set with a computable equality relation such that > there is no computable total order. > > I think the following computable function shows that it is always > possible (it chooses an order during queries): > > Maintain a table, initially emtpy > > As soon as (a <= b) is requested, see if a and b are already in the > table (using the computatble equality function) , if so, use their > ordering in the table. > If an element is not in the table, add it. > > Hence the table gives a consistent total order (it depends on which > ordering queries are requested, but that is not relevant?) > > > > > > > 2015-01-01 16:06 GMT+01:00 Atze van der Ploeg >: > > Nope you're right. Indeed uncompatible with the field structure. Now > I'm confused :) > > I now understand your question, but do not immediately know the > answer. Anyone? > > On Jan 1, 2015 4:02 PM, "Tom Ellis" > > wrote: > > On Thu, Jan 01, 2015 at 03:52:26PM +0100, Atze van der Ploeg wrote: > > If we do not require that (a <= b) && (a >= b) ==> a == b > (where <= is > > from the total ordering and == is from the equality relation) > then it is > > trivial, take the total ordering forall x y. x <= y that i > mentioned > > earlier. > > > > So the compatiblity with equality (you say field structure) is > not besides > > the point, in fact antisymmetry means that the ordering > corresponds to the > > equality relation. > > > > Clear now or did I misunderstand? > > Here is my proposed equality and ordering on the complex numbers: > > data Complex = Complex (Double, Double) deriving (Eq, Ord) > > Does this violate any of my requested conditions? > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From sven.bartscher at weltraumschlangen.de Thu Jan 1 19:45:44 2015 From: sven.bartscher at weltraumschlangen.de (Sven Bartscher) Date: Thu, 1 Jan 2015 20:45:44 +0100 Subject: [Haskell-cafe] Porting setlocale to Windows Message-ID: <20150101204544.39b1c11d@sven.bartscher> Greetings, A while ago I took over the packages setlocale. I now would like to make it portable to windows, but came across the problem that LC_MESSAGES isn't defined on mingw. I thought about these options, for solving this: - Not defining LC_MESSAGES, which would mean, every package using LC_MESSAGES wouldn't be portable to windows. - Defining LC_MESSAGES as some an error, which would basically have the same problem as above. I don't like either of these solutions, but don't know any better. I would be happy about suggestions. Regards Sven -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digitale Signatur von OpenPGP URL: From bog at khumba.net Thu Jan 1 21:29:59 2015 From: bog at khumba.net (Bryan Gardiner) Date: Thu, 1 Jan 2015 13:29:59 -0800 Subject: [Haskell-cafe] Overlapping instances with "instance F a => G a" Message-ID: <20150101132959.7fb38004@khumba.net> Hi cafe! Happy New Year. I'm writing a version of the Binary typeclass that encodes values with host endianness, and I have the code at the bottom of the message. HostBinary provides the encoding/decoding interface, and with HostBinaryNum I want to be able to write only e.g. "instance HostBinaryNum Int32" for numeric types. I had the manual HostBinary Word8 and HostBinary Int8 instances before I wrote HostBinaryNum. What I can't see is why I get this error at all: Binary.hs:21:29: Overlapping instances for HostBinary Word8 arising from a use of ?hget? Matching instances: instance HostBinary Word8 -- Defined at Binary.hs:16:10 instance HostBinaryNum a => HostBinary a -- Defined at Binary.hs:26:10 In the second argument of ?fmap?, namely ?(hget :: Get Word8)? In the expression: fmap fromIntegral (hget :: Get Word8) In an equation for ?hget?: hget = fmap fromIntegral (hget :: Get Word8) and also why commenting out either the HostBinary Int8 or the HostBinaryNum a => HostBinary a instances fixes the problem; and yet, the HostBinaryNum Word8 is accepted! Doesn't "HostBinaryNum a => HostBinary a" create a HostBinary instance for all instances of HostBinaryNum only? So why would it cause problems with an Int8 instance, and why isn't the HostBinaryNum Word8 instance needed to trigger a collision with the explicit HostBinary Word8? GHC 7.8.3, if it matters. Thanks for any clarifiation you can provide, Bryan Binary.hs: {-# LANGUAGE FlexibleInstances, UndecidableInstances #-} module Binary where import Data.Binary.Get import Data.Binary.Put import Data.Bits import Data.Int import Data.Word import Foreign.Storable class HostBinary a where hget :: Get a hput :: a -> Put instance HostBinary Word8 where hget = getWord8 hput = putWord8 instance HostBinary Int8 where hget = fmap fromIntegral (hget :: Get Word8) hput = hput . (fromIntegral :: Int8 -> Word8) class (Bits a, Integral a, Storable a) => HostBinaryNum a instance HostBinaryNum a => HostBinary a where hget = getNum hput = putNum --instance HostBinaryNum Word8 getNum :: (Bits a, Integral a, Storable a) => Get a getNum = undefined putNum :: (Bits a, Integral a, Storable a) => a -> Put putNum = undefined -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Thu Jan 1 21:52:53 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Thu, 1 Jan 2015 21:52:53 +0000 Subject: [Haskell-cafe] Overlapping instances with "instance F a => G a" In-Reply-To: <20150101132959.7fb38004@khumba.net> References: <20150101132959.7fb38004@khumba.net> Message-ID: <20150101215252.GB17602@weber> On Thu, Jan 01, 2015 at 01:29:59PM -0800, Bryan Gardiner wrote: > Overlapping instances for HostBinary Word8 [..] > Doesn't "HostBinaryNum a => HostBinary a" create a HostBinary instance > for all instances of HostBinaryNum only? [..] > instance HostBinary Word8 where [..] > instance HostBinaryNum a => HostBinary a where AIUI `instance HostBinaryNum a => HostBinary a` means "Every instance of the form `HostBinary a` arises from an instance for `HostBinaryNum a`", so provding an additional instance `HostBinary Word8` creates (potential) overlap. Tom From rasen.dubi at gmail.com Thu Jan 1 22:13:58 2015 From: rasen.dubi at gmail.com (Alexey Shmalko) Date: Fri, 2 Jan 2015 00:13:58 +0200 Subject: [Haskell-cafe] Porting setlocale to Windows In-Reply-To: <20150101204544.39b1c11d@sven.bartscher> References: <20150101204544.39b1c11d@sven.bartscher> Message-ID: Hi, The third option is to make `setLocale LC_MESSAGES` do nothing. I believe, it's perfectly acceptable in this case and is much better than making it an error. Regards, Alexey 2015-01-01 21:45 GMT+02:00 Sven Bartscher < sven.bartscher at weltraumschlangen.de>: > Greetings, > > A while ago I took over the packages setlocale. > I now would like to make it portable to windows, but came across the > problem that LC_MESSAGES isn't defined on mingw. > I thought about these options, for solving this: > - Not defining LC_MESSAGES, which would mean, every package using > LC_MESSAGES wouldn't be portable to windows. > - Defining LC_MESSAGES as some an error, which would basically have > the same problem as above. > > I don't like either of these solutions, but don't know any better. > I would be happy about suggestions. > > Regards > Sven > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Thu Jan 1 22:15:31 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Thu, 1 Jan 2015 17:15:31 -0500 Subject: [Haskell-cafe] Overlapping instances with "instance F a => G a" In-Reply-To: <20150101132959.7fb38004@khumba.net> References: <20150101132959.7fb38004@khumba.net> Message-ID: On Thu, Jan 1, 2015 at 4:29 PM, Bryan Gardiner wrote: > Doesn't "HostBinaryNum a => HostBinary a" create a HostBinary instance > for all instances of HostBinaryNum only? So why would it cause > No, it creates an instance for all types, then checks for HostBinaryNum at the point where it tries to use the instance. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From sven.bartscher at weltraumschlangen.de Thu Jan 1 22:57:37 2015 From: sven.bartscher at weltraumschlangen.de (Sven Bartscher) Date: Thu, 1 Jan 2015 23:57:37 +0100 Subject: [Haskell-cafe] Porting setlocale to Windows In-Reply-To: References: <20150101204544.39b1c11d@sven.bartscher> Message-ID: <20150101235737.6db99338@sven.bartscher> I assume that "do nothing", means that a call to `setLocale LC_MESSAGES x` always returns Nothing (which may confuse some applications, but maybe it does in the right way). Then there's the question left, what categoryToCInt does. I could change it's signature to `Category -> Maybe CInt`, but that would mean breaking the API. Instead I could make say `categoryToCInt LC_MESSAGES = -1`, which may confuse some applications which assume that categoryToCInt returns valid integers. But I guess, that's not that much of a problem, since categoryToCInt is not really often used in packages other than setlocale itself. Regards Sven On Fri, 2 Jan 2015 00:13:58 +0200 Alexey Shmalko wrote: > Hi, > > The third option is to make `setLocale LC_MESSAGES` do nothing. I believe, > it's perfectly acceptable in this case and is much better than making it an > error. > > Regards, > Alexey > > 2015-01-01 21:45 GMT+02:00 Sven Bartscher < > sven.bartscher at weltraumschlangen.de>: > > > Greetings, > > > > A while ago I took over the packages setlocale. > > I now would like to make it portable to windows, but came across the > > problem that LC_MESSAGES isn't defined on mingw. > > I thought about these options, for solving this: > > - Not defining LC_MESSAGES, which would mean, every package using > > LC_MESSAGES wouldn't be portable to windows. > > - Defining LC_MESSAGES as some an error, which would basically have > > the same problem as above. > > > > I don't like either of these solutions, but don't know any better. > > I would be happy about suggestions. > > > > Regards > > Sven > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digitale Signatur von OpenPGP URL: From doug at cs.dartmouth.edu Thu Jan 1 23:57:55 2015 From: doug at cs.dartmouth.edu (Doug McIlroy) Date: Thu, 01 Jan 2015 18:57:55 -0500 Subject: [Haskell-cafe] Re; ordNub Message-ID: <201501012357.t01NvtPq014701@coolidge.cs.dartmouth.edu> > I think the following computable function shows that it is always > possible (it chooses an order during queries): > Maintain a table, initially emtpy > As soon as (a <= b) is requested, see if a and b are already in > the table (using the computatble equality function) , if so, use > their ordering in the table. If an element is not in the table, add it. > Hence the table gives a consistent total order (it depends on which > ordering queries are requested, but that is not relevant?) This method has more than Gedanken value. Amusingly, I used it in "A killer adversary to quicksort" [Software - Practice and Experience 29 (1999) 341-344, http://www.cs.dartmouth.edu/~doug/mdmspe.pdf] to drive essentially any quicksort (illustrated with the C standard sort interface) into quadratic behavior. Doug McIlroy From michael at orlitzky.com Fri Jan 2 04:02:49 2015 From: michael at orlitzky.com (Michael Orlitzky) Date: Thu, 01 Jan 2015 23:02:49 -0500 Subject: [Haskell-cafe] Modifying a product type generically Message-ID: <54A61869.1020907@orlitzky.com> I've been playing with generic conversions between simple product types. For example, converting (Bar Int Int) back and forth between (Int,Int). See, https://www.haskell.org/pipermail/haskell-cafe/2014-December/117489.html These save me a *lot* of boilerplate. But naturally, I've gotten greedy. Another transformation I need to make takes one data type, and sticks a new field on the beginning of it. So I'd like to be able to take a, Foo Int Int and construct a, BigFoo String Int Int with as little code as possible. In my real problem, Foo may have 30 fields, and BigFoo 31 -- if you know of a better way, stop me now. And, I actually managed to do it using generics-sop: > prepend "Hello" (Foo 1 2) :: BigFoo BigFoo "Hello" 1 2 But, I had to do something dirty; I used an incomplete pattern match. I don't know enough about what's going on here to handle the other case for prepend_sop. I basically guessed the existing type signatures because it wouldn't work without them. I would like to either, a) Get prepend_sop working for sums of products (the missing case), not just a single product (the one I've got working) b) Restrict prepend_sop to the case that I've got working via the type system, somehow In other words, I don't want it to be crashy, but I'm stuck. Here's the complete working code for the example above. {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} module Prepend where import qualified GHC.Generics as GHC import Generics.SOP data Foo = Foo Int Int deriving (Show, GHC.Generic) instance Generic Foo -- A "copy" of Foo, with a String in front of it. data BigFoo = BigFoo String Int Int deriving (Show, GHC.Generic) instance Generic BigFoo prepend_sop :: (xss ~ (x ': xs), (yss ~ ((a ': x) ': xs))) => a -> SOP I xss -> SOP I yss prepend_sop z (SOP (Z rest)) = SOP $ Z ((I z) :* rest) --prepend_sop z (SOP (S rest)) = ??? prepend :: (Generic a, Generic c, Code a ~ (x ': xs), Code c ~ ((b ': x) ': xs)) => b -> a -> c prepend z = to . (prepend_sop z) . from From rasen.dubi at gmail.com Fri Jan 2 08:32:01 2015 From: rasen.dubi at gmail.com (Alexey Shmalko) Date: Fri, 2 Jan 2015 10:32:01 +0200 Subject: [Haskell-cafe] Porting setlocale to Windows In-Reply-To: <20150101235737.6db99338@sven.bartscher> References: <20150101204544.39b1c11d@sven.bartscher> <20150101235737.6db99338@sven.bartscher> Message-ID: According to man 3 setlocale: > The setlocale() function returns NULL and > fails to change the locale if the given combi- > nation of category and locale makes no sense. So, returning Nothing seems just fine for me. I believe categoryToCInt can return any CInt, because it's result is implementation detail. I mean, applications can't make any assumption based on result of categoryToCInt. That's why changing it (while keeping its type) shouldn't break anything. Regards, Alexey 2015-01-02 0:57 GMT+02:00 Sven Bartscher : > I assume that "do nothing", means that a call to > `setLocale LC_MESSAGES x` always returns Nothing (which may confuse > some applications, but maybe it does in the right way). > > Then there's the question left, what categoryToCInt does. I could > change it's signature to `Category -> Maybe CInt`, but that would mean > breaking the API. Instead I could make say > `categoryToCInt LC_MESSAGES = -1`, which may confuse some applications > which assume that categoryToCInt returns valid integers. But I guess, > that's not that much of a problem, since categoryToCInt is not really > often used in packages other than setlocale itself. > > Regards > Sven > > On Fri, 2 Jan 2015 00:13:58 +0200 > Alexey Shmalko wrote: > >> Hi, >> >> The third option is to make `setLocale LC_MESSAGES` do nothing. I believe, >> it's perfectly acceptable in this case and is much better than making it an >> error. >> >> Regards, >> Alexey >> >> 2015-01-01 21:45 GMT+02:00 Sven Bartscher < >> sven.bartscher at weltraumschlangen.de>: >> >> > Greetings, >> > >> > A while ago I took over the packages setlocale. >> > I now would like to make it portable to windows, but came across the >> > problem that LC_MESSAGES isn't defined on mingw. >> > I thought about these options, for solving this: >> > - Not defining LC_MESSAGES, which would mean, every package using >> > LC_MESSAGES wouldn't be portable to windows. >> > - Defining LC_MESSAGES as some an error, which would basically have >> > the same problem as above. >> > >> > I don't like either of these solutions, but don't know any better. >> > I would be happy about suggestions. >> > >> > Regards >> > Sven >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> > >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From roma at ro-che.info Fri Jan 2 09:22:28 2015 From: roma at ro-che.info (Roman Cheplyaka) Date: Fri, 02 Jan 2015 11:22:28 +0200 Subject: [Haskell-cafe] Modifying a product type generically In-Reply-To: <54A61869.1020907@orlitzky.com> References: <54A61869.1020907@orlitzky.com> Message-ID: <54A66354.70805@ro-che.info> The absent case corresponds to a multi-constructor type. You need to decide what to do in that case. You can decide not to allow it, in which case you can enforce it by saying (xss ~ '[x], yss ~ '[a ': x]) (essentially replacing xs with '[]). Or perhaps you do want to handle those cases; then it depends on how exactly you want to map multiple constructors. Roman On 02/01/15 06:02, Michael Orlitzky wrote: > I've been playing with generic conversions between simple product types. > For example, converting (Bar Int Int) back and forth between (Int,Int). See, > > https://www.haskell.org/pipermail/haskell-cafe/2014-December/117489.html > > These save me a *lot* of boilerplate. But naturally, I've gotten greedy. > Another transformation I need to make takes one data type, and sticks a > new field on the beginning of it. So I'd like to be able to take a, > > Foo Int Int > > and construct a, > > BigFoo String Int Int > > with as little code as possible. In my real problem, Foo may have 30 > fields, and BigFoo 31 -- if you know of a better way, stop me now. > > And, I actually managed to do it using generics-sop: > > > prepend "Hello" (Foo 1 2) :: BigFoo > BigFoo "Hello" 1 2 > > But, I had to do something dirty; I used an incomplete pattern match. I > don't know enough about what's going on here to handle the other case > for prepend_sop. I basically guessed the existing type signatures > because it wouldn't work without them. > > I would like to either, > > a) Get prepend_sop working for sums of products (the missing case), > not just a single product (the one I've got working) > > b) Restrict prepend_sop to the case that I've got working via the > type system, somehow > > In other words, I don't want it to be crashy, but I'm stuck. Here's the > complete working code for the example above. > > > {-# LANGUAGE DataKinds #-} > {-# LANGUAGE DeriveGeneric #-} > {-# LANGUAGE TypeFamilies #-} > {-# LANGUAGE TypeOperators #-} > module Prepend > where > > import qualified GHC.Generics as GHC > import Generics.SOP > > data Foo = Foo Int Int > deriving (Show, GHC.Generic) > > instance Generic Foo > > -- A "copy" of Foo, with a String in front of it. > data BigFoo = BigFoo String Int Int > deriving (Show, GHC.Generic) > > instance Generic BigFoo > > prepend_sop :: (xss ~ (x ': xs), (yss ~ ((a ': x) ': xs))) > => a > -> SOP I xss > -> SOP I yss > prepend_sop z (SOP (Z rest)) = SOP $ Z ((I z) :* rest) > --prepend_sop z (SOP (S rest)) = ??? > > prepend :: (Generic a, Generic c, Code a ~ (x ': xs), > Code c ~ ((b ': x) ': xs)) > => b > -> a > -> c > prepend z = to . (prepend_sop z) . from > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From sven.bartscher at weltraumschlangen.de Fri Jan 2 09:46:25 2015 From: sven.bartscher at weltraumschlangen.de (Sven Bartscher) Date: Fri, 2 Jan 2015 10:46:25 +0100 Subject: [Haskell-cafe] Porting setlocale to Windows In-Reply-To: References: <20150101204544.39b1c11d@sven.bartscher> <20150101235737.6db99338@sven.bartscher> Message-ID: <20150102104625.6eea81a1@sven.bartscher> But the result of categoryToCInt is, normally guaranteed to return a result that you can pass to setlocale, which isn't satisfied in this case. Regards Sven On Fri, 2 Jan 2015 10:32:01 +0200 Alexey Shmalko wrote: > According to man 3 setlocale: > > The setlocale() function returns NULL and > > fails to change the locale if the given combi- > > nation of category and locale makes no sense. > > So, returning Nothing seems just fine for me. > > I believe categoryToCInt can return any CInt, because it's result is > implementation detail. I mean, applications can't make any assumption > based on result of categoryToCInt. That's why changing it (while > keeping its type) shouldn't break anything. > > Regards, > Alexey > > 2015-01-02 0:57 GMT+02:00 Sven Bartscher : > > I assume that "do nothing", means that a call to > > `setLocale LC_MESSAGES x` always returns Nothing (which may confuse > > some applications, but maybe it does in the right way). > > > > Then there's the question left, what categoryToCInt does. I could > > change it's signature to `Category -> Maybe CInt`, but that would mean > > breaking the API. Instead I could make say > > `categoryToCInt LC_MESSAGES = -1`, which may confuse some applications > > which assume that categoryToCInt returns valid integers. But I guess, > > that's not that much of a problem, since categoryToCInt is not really > > often used in packages other than setlocale itself. > > > > Regards > > Sven > > > > On Fri, 2 Jan 2015 00:13:58 +0200 > > Alexey Shmalko wrote: > > > >> Hi, > >> > >> The third option is to make `setLocale LC_MESSAGES` do nothing. I believe, > >> it's perfectly acceptable in this case and is much better than making it an > >> error. > >> > >> Regards, > >> Alexey > >> > >> 2015-01-01 21:45 GMT+02:00 Sven Bartscher < > >> sven.bartscher at weltraumschlangen.de>: > >> > >> > Greetings, > >> > > >> > A while ago I took over the packages setlocale. > >> > I now would like to make it portable to windows, but came across the > >> > problem that LC_MESSAGES isn't defined on mingw. > >> > I thought about these options, for solving this: > >> > - Not defining LC_MESSAGES, which would mean, every package using > >> > LC_MESSAGES wouldn't be portable to windows. > >> > - Defining LC_MESSAGES as some an error, which would basically have > >> > the same problem as above. > >> > > >> > I don't like either of these solutions, but don't know any better. > >> > I would be happy about suggestions. > >> > > >> > Regards > >> > Sven > >> > > >> > _______________________________________________ > >> > Haskell-Cafe mailing list > >> > Haskell-Cafe at haskell.org > >> > http://www.haskell.org/mailman/listinfo/haskell-cafe > >> > > >> > > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digitale Signatur von OpenPGP URL: From rasen.dubi at gmail.com Fri Jan 2 11:17:34 2015 From: rasen.dubi at gmail.com (Alexey Shmalko) Date: Fri, 2 Jan 2015 13:17:34 +0200 Subject: [Haskell-cafe] Porting setlocale to Windows In-Reply-To: <20150102104625.6eea81a1@sven.bartscher> References: <20150101204544.39b1c11d@sven.bartscher> <20150101235737.6db99338@sven.bartscher> <20150102104625.6eea81a1@sven.bartscher> Message-ID: Okay. categoryToCInt returns you -1, which you pass to setlocale and get NULL back, then convert it to Nothing and return to Haskell space. I'm just wondering, why categoryToCInt is exported at all? 2015-01-02 11:46 GMT+02:00 Sven Bartscher : > But the result of categoryToCInt is, normally guaranteed to return a > result that you can pass to setlocale, which isn't satisfied in this > case. > > Regards > Sven > > On Fri, 2 Jan 2015 10:32:01 +0200 > Alexey Shmalko wrote: > >> According to man 3 setlocale: >> > The setlocale() function returns NULL and >> > fails to change the locale if the given combi- >> > nation of category and locale makes no sense. >> >> So, returning Nothing seems just fine for me. >> >> I believe categoryToCInt can return any CInt, because it's result is >> implementation detail. I mean, applications can't make any assumption >> based on result of categoryToCInt. That's why changing it (while >> keeping its type) shouldn't break anything. >> >> Regards, >> Alexey >> >> 2015-01-02 0:57 GMT+02:00 Sven Bartscher : >> > I assume that "do nothing", means that a call to >> > `setLocale LC_MESSAGES x` always returns Nothing (which may confuse >> > some applications, but maybe it does in the right way). >> > >> > Then there's the question left, what categoryToCInt does. I could >> > change it's signature to `Category -> Maybe CInt`, but that would mean >> > breaking the API. Instead I could make say >> > `categoryToCInt LC_MESSAGES = -1`, which may confuse some applications >> > which assume that categoryToCInt returns valid integers. But I guess, >> > that's not that much of a problem, since categoryToCInt is not really >> > often used in packages other than setlocale itself. >> > >> > Regards >> > Sven >> > >> > On Fri, 2 Jan 2015 00:13:58 +0200 >> > Alexey Shmalko wrote: >> > >> >> Hi, >> >> >> >> The third option is to make `setLocale LC_MESSAGES` do nothing. I believe, >> >> it's perfectly acceptable in this case and is much better than making it an >> >> error. >> >> >> >> Regards, >> >> Alexey >> >> >> >> 2015-01-01 21:45 GMT+02:00 Sven Bartscher < >> >> sven.bartscher at weltraumschlangen.de>: >> >> >> >> > Greetings, >> >> > >> >> > A while ago I took over the packages setlocale. >> >> > I now would like to make it portable to windows, but came across the >> >> > problem that LC_MESSAGES isn't defined on mingw. >> >> > I thought about these options, for solving this: >> >> > - Not defining LC_MESSAGES, which would mean, every package using >> >> > LC_MESSAGES wouldn't be portable to windows. >> >> > - Defining LC_MESSAGES as some an error, which would basically have >> >> > the same problem as above. >> >> > >> >> > I don't like either of these solutions, but don't know any better. >> >> > I would be happy about suggestions. >> >> > >> >> > Regards >> >> > Sven >> >> > >> >> > _______________________________________________ >> >> > Haskell-Cafe mailing list >> >> > Haskell-Cafe at haskell.org >> >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > >> >> > >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From atzeus at gmail.com Fri Jan 2 11:33:31 2015 From: atzeus at gmail.com (Atze van der Ploeg) Date: Fri, 2 Jan 2015 12:33:31 +0100 Subject: [Haskell-cafe] GHC(STG, Cmm, asm) illustrated for hardware persons In-Reply-To: References: <20141231190807.GD5496@teal.hq.k1024.org> Message-ID: Awesome! Thanks for sharing! I don't think this is only useful for ?hardware people?. Maybe call it the haskell abstraction layers cheat sheets? :) On Jan 1, 2015 4:47 PM, "Takenobu Tani" wrote: > Hi everyone, > > Thank you for your warm comments and feedback. > I'm glad if I can contribute to the community. > > I'll update based on the feedback. > But my work is very slow. Because it's my night and weekend work(fun) ;-) > Thank you. > > Enjoy, > Takenobu > > > 2015-01-01 4:08 GMT+09:00 Iustin Pop : > >> On Thu, Jan 01, 2015 at 12:40:55AM +0900, Takenobu Tani wrote: >> > Dear Haskellers, >> > >> > I love haskell. >> > I'm studying and playing around with Haskell, GHC, STG, Cmm, asm... >> > >> > When I started studying them, I wanted some figures. >> > I've not have some mental models because I am a hardware person. >> > >> > So I am drawing few illustrations for hardware persons. Here is: >> > >> > GHC(STG,Cmm,asm) illustrated for hardware persons >> > http://takenobu-hs.github.io/downloads/haskell_ghc_illustrated.pdf >> > https://github.com/takenobu-hs/haskell-ghc-illustrated >> >> Excellent slides, thank you very much! Learned quite a few things, and >> will need to re-read them more in depth after a while :) >> >> Happy New Year to everyone, >> iustin >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alfredo.dinapoli at gmail.com Fri Jan 2 11:41:09 2015 From: alfredo.dinapoli at gmail.com (Alfredo Di Napoli) Date: Fri, 2 Jan 2015 12:41:09 +0100 Subject: [Haskell-cafe] Weird reachability issue with haskell.org my my Italian ISP (fastweb) In-Reply-To: References: <7d232cd9-df41-4791-8889-caa42903e7ff@googlegroups.com> Message-ID: <22F9A8A7-B9E7-411B-B058-6D700426F60B@gmail.com> I ended up using a machine running privoxy (using aws or similar) and that works, but I'm not sure I want to pay for the idiocity of my ISP. Happy new year all, anyway. Alfredo Di Napoli > On 01/gen/2015, at 11:53, Giacomo Cosenza wrote: > > Same thing here too. few weeks ago there were no problems. > mimmo > >> On Tuesday, December 30, 2014 8:26:15 PM UTC+1, george watkins wrote: >> Lo stesso, same thing here . >> I am using this mirror if for hoogle it can help https://www.fpcomplete.com/hoogle. >> At the beginnig i thought it was my dns improperly configured or something wrong with my network >> >> Il giorno marted? 23 dicembre 2014 18:55:00 UTC+1, Alfredo Di Napoli ha scritto: >>> >>> Hello Caf?, >>> >>> let me start with the email I've sent to Rackspace, which will help you understand the context: >>> >>>> Hi there! >>> >>>> I'm trying to understand how come I can't reach www.haskell.org from my ISP here in Italy (fastweb). In order to troubleshoot the issue, I tried dig on it, revealing it's hosted by you: >>> >>>> dig haskell.org >>> >>>> >>>> ; <<>> DiG 9.8.3-P1 <<>> haskell.org >>>> ;; global options: +cmd >>>> ;; Got answer: >>>> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63629 >>>> ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 >>>> ;; QUESTION SECTION: >>>> ;haskell.org.INA >>>> ;; ANSWER SECTION: >>>> haskell.org. 299 IN A 23.253.242.70 >>>> ;; Query time: 139 msec >>>> ;; SERVER: 8.8.8.8#53(8.8.8.8) >>>> ;; WHEN: Tue Dec 23 18:33:00 2014 >>>> ;; MSG SIZE rcvd: 45 >>> >>>> Trying a whois reveals the subnet is the entire 23.253.0.0 one: >>> >>>> Rackspace Cloud Servers RACKS-8-1387376775861482 (NET-23-253-80-0-1) 23.253.80.0 - 23.253.95.255 >>>> Rackspace Hosting RACKS-8-NET-15 (NET-23-253-0-0-1) 23.253.0.0 - 23.253.255.25 >>> >>>> If I try to ping the IP directly, it obviously doesn't work, so I have tried contiguous IP addresses in the same subnet to see if the subnet itself was reachable at all.. trying 23.253.89.73 indeed worked! It resolved to >>>> http://www.papamurphys.com/ >>>> This means my ISP can reach that subnet, but doesn't explain why it can't connect to 23.253.242.70. >>> >>> >>> That's very weird indeed, as every other website is reachable, only haskell.org is not! How funny my fate is! I'm one of the few Haskellers in Italy and yet I cannot access the website.. perhaps is the consequence of "Avoid success at all costs"?? :) :) >>> >>> Jokes aside, do you guys know (I'm asking mainly to Austin here) if rackspace uses some weird setup for their website deployment or if haskell.org is hosted "the usual way" and listening on port 80? >>> >>> Thanks in advance for the 1% who is concerned, for all the other 99%, merry Xmas ;) >>> >>> Alfredo -------------- next part -------------- An HTML attachment was scrubbed... URL: From heraldhoi at gmail.com Fri Jan 2 11:51:06 2015 From: heraldhoi at gmail.com (Geraldus) Date: Fri, 02 Jan 2015 11:51:06 +0000 Subject: [Haskell-cafe] GHC(STG, Cmm, asm) illustrated for hardware persons References: <20141231190807.GD5496@teal.hq.k1024.org> Message-ID: Thank you! It was interesting and informative! Fri Jan 02 2015 at 16:33:40, Atze van der Ploeg : > Awesome! Thanks for sharing! I don't think this is only useful for > ?hardware people?. Maybe call it the haskell abstraction layers cheat > sheets? :) > On Jan 1, 2015 4:47 PM, "Takenobu Tani" wrote: > >> Hi everyone, >> >> Thank you for your warm comments and feedback. >> I'm glad if I can contribute to the community. >> >> I'll update based on the feedback. >> But my work is very slow. Because it's my night and weekend work(fun) ;-) >> Thank you. >> >> Enjoy, >> Takenobu >> >> >> 2015-01-01 4:08 GMT+09:00 Iustin Pop : >> >>> On Thu, Jan 01, 2015 at 12:40:55AM +0900, Takenobu Tani wrote: >>> > Dear Haskellers, >>> > >>> > I love haskell. >>> > I'm studying and playing around with Haskell, GHC, STG, Cmm, asm... >>> > >>> > When I started studying them, I wanted some figures. >>> > I've not have some mental models because I am a hardware person. >>> > >>> > So I am drawing few illustrations for hardware persons. Here is: >>> > >>> > GHC(STG,Cmm,asm) illustrated for hardware persons >>> > http://takenobu-hs.github.io/downloads/haskell_ghc_illustrated.pdf >>> > https://github.com/takenobu-hs/haskell-ghc-illustrated >>> >>> Excellent slides, thank you very much! Learned quite a few things, and >>> will need to re-read them more in depth after a while :) >>> >>> Happy New Year to everyone, >>> iustin >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg.grenrus at iki.fi Fri Jan 2 14:25:28 2015 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Fri, 2 Jan 2015 16:25:28 +0200 Subject: [Haskell-cafe] Negable constraints on boolean normal forms In-Reply-To: References: Message-ID: I?ll try to find time to experiment with API and make a PoC in the beginning of the next week. Currently I have no idea what the API could be. It would be nice if it will turn out so you could do `CNF a -> NNF a` and `DNF a -> NFF a` transformations without any restrictions on `a`. Yet you still need `Negable a` to do reversed transformations as well as `CNF a <-> DNF a` Let?s see how it turns out. I?ll try to come back with something before Epiphany (i.e. on Monday). > On 01 Jan 2015, at 18:04, Yitzchak Gale wrote: > > Yes, sounds great! > > In practice, what I really need right now is to be > able to convert between normal forms without > contraints on the value type. If that will do it - > I'm happy. > > But beyond that, this is a nice library that is > well thought out. Grounded in good theory, but > still easily understandable and usable. Any > further development in that direction would of > course be appreciated! > > In terms of specifics - would we need replacements > for CoBoolean and CoBoolean1 if we move to > a richer lattice-based organization of the types? > Or would we then be able to move to simpler API like > toLattice, fromLattice, toNormalForm, etc. for the > conversions, that would just work? > > Thanks, > Yitz > > On Thu, Jan 1, 2015 at 5:45 PM, Oleg Grenrus wrote: >> First of all: nice to hear that someone is using boolean-normal-forms! >> >> I totally feel your pain. Indeed there is >> ?Monoid is used, where Semigroup would be enough? issue. >> >> `Boolean` is too strong class there.. I?d like to rework >> the classes to have hierarchy: >> Lattice => Boolean >> Complementable >> Maybe also `Heyting` and `Negable`. >> >> Then NNF would be free Lattice, and DNF and CNF are also just lattices. >> >> With more granular classes, the requirements for transformations could be >> more precise. >> >> How does this sound? >> >> Cheers, >> Oleg >> >>> On 01 Jan 2015, at 17:06, Yitzchak Gale wrote: >>> >>> I've been using Oleg Genrus' wonderful boolean-normal-forms >>> library lately, and enjoying it. However, I'm running into >>> some trouble with overly constrained conversions. >>> >>> In theory, it's possible to convert between any of the >>> normal forms without requiring a Negable instance on >>> the value type. But the conversion mechanism in the >>> library routes everything via the Boolean type class, >>> and that ends up slapping a Negable constraint on everything. >>> >>> You can work around that by embedding your value type >>> in the free Negable, conveniently provided by the library. >>> But in practice that causes a lot of trouble. You end >>> up being required to deal with Neg cases in your result type >>> that are actually impossible to occur and make no sense >>> in context. You have to throw bottoms into provably total >>> functions, or write code that produces meaningless results >>> that you promise in human-readable comments will never >>> happen in practice. You also make the code less efficient >>> by requiring extra passes over the data to "verify" that Neg >>> isn't there. It's similar to what happens when you try to use >>> a Monoid where a Semigroup is really needed by bolting on >>> an artificial "empty" constructor. >>> >>> One thing you can do to begin with is to remove the >>> Negable constraints on the NormalForm instances; >>> I don't see that constraint ever being used. But that still >>> doesn't solve the main issue. >>> >>> Perhaps one approach would be to define a >>> Boolean "bi-monoid" class, where a Boolean bi-monoid >>> is a like Boolean algebra except without negation. >>> All of the normal forms are instances of Boolean bi-monoid >>> even without a Negable constraint on the value type. >>> >>> If you then relax the constraints on the methods of >>> CoBoolean and CoBoolean1 to Boolean bi-monoid instead >>> of Boolean, all of the existing conversion implementations >>> work without modification and without requiring the Negable >>> constraint. >>> >>> I'm not sure if that creates other problems for some other >>> use cases of this library though. >>> >>> Any thoughts? >>> >>> Thanks, >>> Yitz >>> >> > From michael at orlitzky.com Fri Jan 2 16:47:46 2015 From: michael at orlitzky.com (Michael Orlitzky) Date: Fri, 02 Jan 2015 11:47:46 -0500 Subject: [Haskell-cafe] Modifying a product type generically In-Reply-To: <54A66354.70805@ro-che.info> References: <54A61869.1020907@orlitzky.com> <54A66354.70805@ro-che.info> Message-ID: <54A6CBB2.9050200@orlitzky.com> On 01/02/2015 04:22 AM, Roman Cheplyaka wrote: > The absent case corresponds to a multi-constructor type. You need to > decide what to do in that case. > > You can decide not to allow it, in which case you can enforce it by saying > > (xss ~ '[x], yss ~ '[a ': x]) > > (essentially replacing xs with '[]). > > Or perhaps you do want to handle those cases; then it depends on how > exactly you want to map multiple constructors. Thanks, this is so cool. Like, I'm eight years old with a working machine gun cool. First, I got it working with your type signature above. That really helped me understand what was going on, but GHC still warned me about the missing case, and I didn't want to "error" it. I see now that `xss` and `yss` are type-level lists-of-lists, and that there's more than one element in that list if we have more than one constructor. If I want to prepend a new type to the list for both cases, I need something better than [a ': x], which only appends the type `a` to the FIRST (only) list in the list-of-lists. Unfortunately, there are no sections for type operators yet =) So this doesn't work: Map (a ':) xs. But the following recursive definition does: type family Prepended a (xs :: [k]) :: [l] type instance Prepended a '[] = '[] type instance Prepended a (x ': xs) = (a ': x) ': (Prepended a xs) The dubious second line makes sense when you realize that we're working on lists-of-lists, and prepending to the INNER lists. Now the type of `yss` is obvious. In fact, we don't need `yss` any more: prepend_sop :: a -> SOP I xss -> SOP I (Prepended a xss) The first case is the same: prepend_sop z (SOP (Z rest)) = SOP $ Z ((I z) :* rest) But the second one I can define recursively: prepend_sop z (SOP (S rest)) = let (SOP result) = prepend_sop z (SOP rest) in SOP $ S $ result The definition of `prepend` is the same, albeit with a new type. And, holy shit, it works. If I give Foo and BigFoo additional constructors, data Foo = Foo Int Int | Bar Int Int deriving (Show, GHC.Generic) instance Generic Foo data BigFoo = BigFoo String Int Int | BigBar String Int Int deriving (Show, GHC.Generic) instance Generic BigFoo then the `prepend` function knows which one to choose based on the constructor! > prepend "Hello" (Foo 1 2) :: BigFoo BigFoo "Hello" 1 2 > prepend "Hello" (Bar 1 2) :: BigFoo BigBar "Hello" 1 2 Awesome. From alexey.skladnoy at gmail.com Fri Jan 2 18:04:41 2015 From: alexey.skladnoy at gmail.com (Aleksey Khudyakov) Date: Fri, 2 Jan 2015 22:04:41 +0400 Subject: [Haskell-cafe] Modifying a product type generically In-Reply-To: <54A61869.1020907@orlitzky.com> References: <54A61869.1020907@orlitzky.com> Message-ID: On 2 January 2015 at 07:02, Michael Orlitzky wrote: > I've been playing with generic conversions between simple product types. > For example, converting (Bar Int Int) back and forth between (Int,Int). See, > > https://www.haskell.org/pipermail/haskell-cafe/2014-December/117489.html > > These save me a *lot* of boilerplate. But naturally, I've gotten greedy. > Another transformation I need to make takes one data type, and sticks a > new field on the beginning of it. So I'd like to be able to take a, > > Foo Int Int > > and construct a, > > BigFoo String Int Int > > with as little code as possible. In my real problem, Foo may have 30 > fields, and BigFoo 31 -- if you know of a better way, stop me now. > Please stop. Some time ago I wrote library exactly for working with product types: fixed-vector-hetero. Example code below. I think > {-# LANGUAGE DeriveGeneric #-} > import qualified Data.Vector.HFixed as H > import GHC.Generics (Generic) > > data Foo = Foo Int Int > deriving (Show,Generic) > data BigFoo = BigFoo String Int Int > deriving (Show,Generic) > > -- Instances are generated automatically using Generic. It's of course > -- possible to write them manually > instance H.HVector Foo > instance H.HVector BigFoo Now you can convert tuple to bar (or any other product types which have same elemets) *Main> H.convert (12,12) :: Foo Foo 12 12 *Main> H.cons "A" (Foo 1 2) :: BigFoo BigFoo "A" 1 2 Note. I've never tuned it for performance. From 0slemi0 at gmail.com Fri Jan 2 18:05:21 2015 From: 0slemi0 at gmail.com (Andras Slemmer) Date: Fri, 2 Jan 2015 19:05:21 +0100 Subject: [Haskell-cafe] Type-directed functions In-Reply-To: References: Message-ID: > I guess that's my basic question: can one write a function that, for a type family of arbitrary structure (possibly recursive or mutually recusrive, multiple cases) "implements" (i.e., has the corresponding signatures of) that type family? No, a function like that wouldn't be as parametric as it's type suggests. In other words you would be able to "pattern match" on types, which would result in a broken type system. For example the parametricity of the type (a -> a) implies that the only inhabitant is the identity function (modulo bottom values). With a function like (a -> TF a) where you can "inspect" 'a' you would be able to write a function (a -> a) that is the identity most of the time, *except* for Ints for which it always returns 0. However if your set of types is finite you have other ways of doing what you want: You can use a GADT to witness this set: data Witness a where WBool :: Witness Bool WChar :: Witness Char and then use the witness in your function: transfromTF :: Witness a -> a -> TF a When you pattern match on say WBool, 'a' will be unified with 'Bool' and the type function will reduce to TypeA Another option is to use DataKinds to create an enumeration of your set of types, and use singletons to derive the witness for the lifted type. This is essentially the same as before, only the GADT is derived for you data MyType = MyBool | MyChar $(singleton ''MyType) -- might me something different haven't used singletons in a while type family Interpret t where Interpret MyBool = Bool Interpret MyChar = Char and then: transformTF :: Sing t -> Interpret t -> TF t On 31 December 2014 at 16:54, Julian Arni wrote: > Assuming you mean things like the 'Extend' type family, and 'extend' > function, this illustrates one of the doubts I have. In particular, if I > have a type family: > > data TypeA = TypeA > > > type family TF where > TF Bool = TypeA > > then I can write a corresponding function with signature Bool -> TF Bool > (since there is only one case for the type family). But suppose I extend TF: > > data TypeB = TypeB > > type family TF where > TF Bool = TypeA > TF Char = TypeB > > Now, I want to write a function "transformTF :: a -> TF a", but 'a' should > really just be restricted to those cases for which 'TF a' is defined. I can > obviously do this with fundeps or ATPs (and a class constraint), but then > I'm moving in the type-class direction, and, as far as I can tell, no > longer benefit from having type families at all. I guess I could also > explicitly pass dictionaries, but that seems even worse. > > I guess that's my basic question: can one write a function that, for a > type family of arbitrary structure (possibly recursive or mutually > recusrive, multiple cases) "implements" (i.e., has the corresponding > signatures of) that type family? > > On Tue, Dec 30, 2014 at 6:47 PM, Atze van der Ploeg > wrote: > >> Hi Julian, >> >> Check out my package ctrex. https://www.haskell.org/haskellwiki/CTRex >> >> Cheers, >> >> Atze >> On Dec 30, 2014 6:20 PM, "Julian Arni" wrote: >> >>> Hi all, >>> >>> I've been playing around with what might be described as type-directed >>> functions. One example is a list-like structure of phantom-typed values >>> >>> {-# LANGUAGE TypeOperators #-} >>> {-# LANGUAGE DataKinds #-} >>> {-# LANGUAGE PolyKinds #-} >>> >>> import GHC.TypeLits >>> >>> infixr 6 ::: >>> data a ::: b = a ::: b >>> deriving (Show, Eq) >>> >>> data Tag b = Tag String >>> deriving (Show, Eq) >>> >>> ex1 :: Tag 5 ::: Tag 3 ::: Tag 7 >>> ex1 = Tag "Alice" ::: Tag "Bob" ::: Tag "Carol" >>> >>> >>> And then sorting 'ex1' based on the Nats, such that >>> >>> sort ex1 :: Tag 3 ::: Tag 5 ::: Tag 7 >>> sort ex1 = Tag "Bob" ::: Tag "Alice" ::: Tag "Carol" >>> >>> Notice how it's the types, not the values, that determine the result, >>> but >>> that the value-level also changes. >>> >>> I know how to do this using classes, but it's a little excruciating - >>> it's >>> like programming in a verbose and very restricted Prolog. With type >>> families >>> it's much easier to get the result *type* (pattern matching is simple, >>> recursive calls are natural, and it all looks a lot more like Haskell), >>> but >>> I haven't yet seen a way of effectively using type families to direct >>> the value-level component of the calculation. >>> >>> Are there any examples of how this might be done? Or are there other >>> alternatives to using type-classes that I am missing? Or, alternatively, >>> are >>> there libraries to reduce the boilerplate of this type-class code? >>> >>> Thanks, >>> Julian >>> >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>> >>> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aditya.siram at gmail.com Fri Jan 2 18:59:52 2015 From: aditya.siram at gmail.com (aditya siram) Date: Fri, 2 Jan 2015 12:59:52 -0600 Subject: [Haskell-cafe] Class constraints on associated types ... Message-ID: Hi all, I'd like to be able to constrain an associated type. I used to have an instance that looked like: class Dispatch a b c | a b -> c where runF :: a -> b -> c instance (C a) => Dispatch D1 D2 ( a -> IO ()) where runF d1 d2 = (\_ -> return ()) Since I upgraded to 7.8 from 7.5 that instance declaration is no longer accepted is no longer accepted since it violates FD's. I have been updating my code to use type families like so: class Dispatch a b where type Impl a b :: * runF :: a -> b -> Impl a b instance (C a) => Dispatch D1 D2 where type Impl D1 D2 = a -> IO () runF d1 d2 = (\_ return ()) Unfortunately the `type Impl ...` line in the instance is rejected because it uses `a` on the RHS. In this one case I could just package it up into a newtype or something but I would ideally like to be able to constrain any number of arguments like: instance (C a, C b ... C z) => Dispatch D1 D2 where type Impl D1 D2 = a -> b -> ... -> z -> IO () ... This was something I could do in 7.6 (although I realize this is way safer). How do I go about getting that constraint back? Thanks! -deech -------------- next part -------------- An HTML attachment was scrubbed... URL: From hesselink at gmail.com Fri Jan 2 19:38:13 2015 From: hesselink at gmail.com (Erik Hesselink) Date: Fri, 2 Jan 2015 20:38:13 +0100 Subject: [Haskell-cafe] Class constraints on associated types ... In-Reply-To: References: Message-ID: Could you do something like this? instance (Impl D1 D2 ~ a -> IO (), C a) => Dispatch D1 D2 Erik On Fri, Jan 2, 2015 at 7:59 PM, aditya siram wrote: > Hi all, > I'd like to be able to constrain an associated type. > > I used to have an instance that looked like: > class Dispatch a b c | a b -> c where > runF :: a -> b -> c > instance (C a) => Dispatch D1 D2 ( a -> IO ()) where > runF d1 d2 = (\_ -> return ()) > > Since I upgraded to 7.8 from 7.5 that instance declaration is no longer > accepted is no longer accepted since it violates FD's. > > I have been updating my code to use type families like so: > class Dispatch a b where > type Impl a b :: * > runF :: a -> b -> Impl a b > instance (C a) => Dispatch D1 D2 where > type Impl D1 D2 = a -> IO () > runF d1 d2 = (\_ return ()) > > Unfortunately the `type Impl ...` line in the instance is rejected because > it uses `a` on the RHS. > > In this one case I could just package it up into a newtype or something but > I would ideally like to be able to constrain any number of arguments like: > instance (C a, C b ... C z) => Dispatch D1 D2 where > type Impl D1 D2 = a -> b -> ... -> z -> IO () > ... > > This was something I could do in 7.6 (although I realize this is way safer). > How do I go about getting that constraint back? > > Thanks! > -deech > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From michael at orlitzky.com Fri Jan 2 20:45:30 2015 From: michael at orlitzky.com (Michael Orlitzky) Date: Fri, 02 Jan 2015 15:45:30 -0500 Subject: [Haskell-cafe] Modifying a product type generically In-Reply-To: References: <54A61869.1020907@orlitzky.com> Message-ID: <54A7036A.5090204@orlitzky.com> On 01/02/2015 01:04 PM, Aleksey Khudyakov wrote: >> >> with as little code as possible. In my real problem, Foo may have 30 >> fields, and BigFoo 31 -- if you know of a better way, stop me now. >> > Please stop. Some time ago I wrote library exactly for working with > product types: fixed-vector-hetero. Example code below. I think > Wow, thanks, this is almost exactly what I've been looking for. My next trick was going to be to combine "convert", "cons", and "tail" operations. >From your example, we can `cons` an "A" to a Foo to get a BigFoo: > H.cons "A" (Foo 1 2) :: BigFoo BigFoo "A" 1 2 And we can `tail` a BigFoo to get a Foo: > H.tail (BigFoo "Hello" 1 2) :: Foo Foo 1 2 But if I combine the two, GHC doesn't know what to do: > H.cons "A" (H.tail (BigFoo "Hello" 1 2)) :: BigFoo :15:1: Couldn't match type ?H.Elems v0? with ?'[Int, Int]? The type variable ?v0? is ambiguous Expected type: [Char] : H.Elems v0 Actual type: H.Elems BigFoo In the expression: H.cons "A" (H.tail (BigFoo "Hello" 1 2)) :: BigFoo In an equation for ?it?: it = H.cons "A" (H.tail (BigFoo "Hello" 1 2)) :: BigFoo I can make it work in this case by supplying a type signature for the intermediate `tail` expression -- but what if there is no such type? Can I trick it into deducing any old type with the right shape? An intermediate tuple would work, for example. Thanks again. From alexey.skladnoy at gmail.com Fri Jan 2 21:03:54 2015 From: alexey.skladnoy at gmail.com (Aleksey Khudyakov) Date: Sat, 3 Jan 2015 01:03:54 +0400 Subject: [Haskell-cafe] Modifying a product type generically In-Reply-To: <54A7036A.5090204@orlitzky.com> References: <54A61869.1020907@orlitzky.com> <54A7036A.5090204@orlitzky.com> Message-ID: > Wow, thanks, this is almost exactly what I've been looking for. My next > trick was going to be to combine "convert", "cons", and "tail" operations. > > From your example, we can `cons` an "A" to a Foo to get a BigFoo: > > > H.cons "A" (Foo 1 2) :: BigFoo > BigFoo "A" 1 2 > > And we can `tail` a BigFoo to get a Foo: > > > H.tail (BigFoo "Hello" 1 2) :: Foo > Foo 1 2 > > But if I combine the two, GHC doesn't know what to do: > > > H.cons "A" (H.tail (BigFoo "Hello" 1 2)) :: BigFoo > > :15:1: > Couldn't match type ?H.Elems v0? with ?'[Int, Int]? > The type variable ?v0? is ambiguous > Expected type: [Char] : H.Elems v0 > Actual type: H.Elems BigFoo > In the expression: > H.cons "A" (H.tail (BigFoo "Hello" 1 2)) :: BigFoo > In an equation for ?it?: > it = H.cons "A" (H.tail (BigFoo "Hello" 1 2)) :: BigFoo > > I can make it work in this case by supplying a type signature for the > intermediate `tail` expression -- but what if there is no such type? Can > I trick it into deducing any old type with the right shape? An > intermediate tuple would work, for example. > This is problem inherent to very generic code. There could be too many types which could be assigned to intermediate extression. GHC deduce that intermediate type must be isomorphic to (Int,Int) but could not chose such type. We however can always create vector with elements of right type. Library works by converting values to Boehm-Berarducci encoding (ContVec), perform operations on and convert back to concrete representation. So we can fix type of intermediate vector to `ContVec xs` and let GHC to figure out rest. So following will work: > import qualified Data.Vector.HFixed.Cont as H (ContVec) > asCont :: H.ContVec a -> H.ContVec a > asCont = id *Main> (H.cons "A" . asCont . H.tail) (BigFoo "Hello" 1 2) :: BigFoo BigFoo "A" 1 2 This function is not in the library but I'm going to add it. It is usefult for combining functions From michael at orlitzky.com Fri Jan 2 21:12:40 2015 From: michael at orlitzky.com (Michael Orlitzky) Date: Fri, 02 Jan 2015 16:12:40 -0500 Subject: [Haskell-cafe] Modifying a product type generically In-Reply-To: References: <54A61869.1020907@orlitzky.com> <54A7036A.5090204@orlitzky.com> Message-ID: <54A709C8.4010602@orlitzky.com> On 01/02/2015 04:03 PM, Aleksey Khudyakov wrote: > >> import qualified Data.Vector.HFixed.Cont as H (ContVec) >> asCont :: H.ContVec a -> H.ContVec a >> asCont = id > > *Main> (H.cons "A" . asCont . H.tail) (BigFoo "Hello" 1 2) :: BigFoo > BigFoo "A" 1 2 > > This function is not in the library but I'm going to add it. It is usefult for > combining functions > Ha ha! It works! I have deleted so much code today. I will also be sending you a pull request with millions of tuple instances =) From roma at ro-che.info Fri Jan 2 23:16:08 2015 From: roma at ro-che.info (Roman Cheplyaka) Date: Sat, 03 Jan 2015 01:16:08 +0200 Subject: [Haskell-cafe] extensible effects and open unions In-Reply-To: <20141202153135.A1518C3854@www1.g3.pair.com> References: <20141202153135.A1518C3854@www1.g3.pair.com> Message-ID: <54A726B8.7030803@ro-che.info> On 02/12/14 17:31, oleg at okmij.org wrote: > To show that one can indeed implement the interface of OpenUnion.hs as > it is *without* Typeable or overlapping instances, I have just written > http://okmij.org/ftp/Haskell/extensible/OpenUnion4.hs It is interesting to note that this is exactly the solution (to almost the same problem) that Andres L?h and I came up with last spring: http://bit.ly/1xgo7fQ Roman From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Sat Jan 3 00:57:39 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Sat, 3 Jan 2015 00:57:39 +0000 Subject: [Haskell-cafe] threepenny-gui: garbage collection Message-ID: <20150103005739.GA21812@weber> Suppose that each time I make a particular threepenny-gui widget, call it a `Foo`, I register an event handler using `on` so that the `Foo` can change its appearance based on some `Event`. Suppose I create, show, and hide a billion `Foo`s, each one never to be shown again. Can they be garbage collected? Presumably there is something storing the callback that was registered for the `Event` and the callback refers to the `Foo`. How then can the `Foo`s be freed? `Reactive.Threepenny.register` talks about an "unregister" action but says "FIXME: Unregistering event handlers does not work yet.". But how could it be known anyway when to unregister? Is there not the possibility of a space leak regardless? Thanks, Tom From apfelmus at quantentunnel.de Sat Jan 3 10:34:07 2015 From: apfelmus at quantentunnel.de (Heinrich Apfelmus) Date: Sat, 03 Jan 2015 11:34:07 +0100 Subject: [Haskell-cafe] threepenny-gui: garbage collection In-Reply-To: <20150103005739.GA21812@weber> References: <20150103005739.GA21812@weber> Message-ID: Tom Ellis wrote: > Suppose that each time I make a particular threepenny-gui widget, call it a > `Foo`, I register an event handler using `on` so that the `Foo` can change > its appearance based on some `Event`. > > Suppose I create, show, and hide a billion `Foo`s, each one never to be > shown again. Can they be garbage collected? Presumably there is something > storing the callback that was registered for the `Event` and the callback > refers to the `Foo`. How then can the `Foo`s be freed? > > `Reactive.Threepenny.register` talks about an "unregister" action but says > "FIXME: Unregistering event handlers does not work yet.". But how could it > be known anyway when to unregister? Is there not the possibility of a space > leak regardless? (Threepenny author here.) This is a classic example of a circular reference that occurs in every GUI program: A widget keeps a reference to an event handler, which in turn keeps a reference to the widget. Of course, GHC's has a well-designed garbage collector that can handle this, but in Threepenny, the situation is actually worse: the widget is managed by the JavaScript runtime, whereas the event handler is managed by the Haskell runtime. I don't know any garbage collector that can resolve cross-runtime circular dependencies. Still, I managed to solve this problem to some extend. :) Essentially, Threepenny mirrors dependencies between JavaScript DOM elements on the Haskell side, and thus allows the Haskell garbage collector to handle this. (I wouldn't want to touch JavaScript garbage collectors with a ten-foot pole.) For your concrete situation, this means that as long as the `Foo` widgets are not inserted into the DOM tree in the browser, and you only use DOM events on them (`UI.click` etc), they will indeed be garbage collected properly whenever their lifetime ends in your Haskell program. (At least, that's the plan. I have tested that it works, but garbage collection is a tricky business, so I wouldn't bet my life on it just yet.) Note that I do have to mirror the JavaScript memory layout, so this only works for the `Element` type at the moment. If you use the `ffiExport` function to export event handlers to the JavaScript side, then they will not be garbage collected. The `Reactive.Threepenny.register` function is totally separate from this, because it doesn't talk to the JavaScript runtime at all. You're right that there might be some issues with `unregister`, but I haven't thought about this yet. Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Sat Jan 3 10:53:23 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Sat, 3 Jan 2015 10:53:23 +0000 Subject: [Haskell-cafe] Postgresql Intervals with Opaleye In-Reply-To: References: <20141230100323.GB11576@weber> Message-ID: <20150103105323.GB21812@weber> On Tue, Dec 30, 2014 at 04:59:29PM -0800, info at rotnetix.com wrote: > That might be tricky... > See https://github.com/lpsmith/postgresql-simple/pull/115, it seems like > it is not trivial to get the conversions to haskell types correct. > > Look like I am back to native SQL for that one. As lpsmith says here https://github.com/lpsmith/postgresql-simple/pull/115#issuecomment-48754627 you can use the attached patch in your own code to get a conversion from `interval` to `DiffTime`. It will have a few strange corner cases but you will probably find you never hit them. Once you've done that you can make them suitable for Opaleye by writing data PGInterval instance QueryRunnerColumnDefault PGInterval DiffTime where queryRunnerColumnDefault = fieldQueryRunnerColumn (you may have to import something from Opaleye.Internal.RunQuery). Please let me know how you get on with that, if you try it. Tom From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Sat Jan 3 11:25:33 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Sat, 3 Jan 2015 11:25:33 +0000 Subject: [Haskell-cafe] Handling Postgresql array types In-Reply-To: <308d3305-cd01-4e03-80ee-40c8cbbbc875@googlegroups.com> References: <20141226110212.GJ31575@weber> <5bde06c8-bbdd-4a6a-b93c-5b02c7628139@googlegroups.com> <20141227112336.GN31575@weber> <20141227120946.GO31575@weber> <1b102f5b-a5b6-4950-a6d1-840ee048302b@googlegroups.com> <20141228133916.GC8035@weber> <02c65c31-69ac-4203-a9e8-c97da6cfc809@googlegroups.com> <4279217e-8ce5-46fd-bad5-beba5fd9fe6f@googlegroups.com> <20141230100105.GA11576@weber> <308d3305-cd01-4e03-80ee-40c8cbbbc875@googlegroups.com> Message-ID: <20150103112533.GD21812@weber> This will create an orphan instance but there's not much that can be done about that short of wrapping Matrix in a newtype. {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-} import Opaleye import Data.Profunctor (rmap) import Data.Profunctor.Product.Default (Default, def) import Data.Matrix (Matrix) -- You have to fill this in yourself matrixFromList :: [[Double]] -> Matrix Double matrixFromList = undefined instance Default QueryRunner (Column (PGArray (PGArray PGFloat8))) (Matrix Double) where def = rmap matrixFromList def On Tue, Dec 30, 2014 at 05:01:06PM -0800, info at rotnetix.com wrote: > Would you be willing to send me an example of how I would do that please? > > Thanks > Riaan > > On Tuesday, December 30, 2014 9:01:19 PM UTC+11, Tom Ellis wrote: > > > > On Sun, Dec 28, 2014 at 06:59:26PM -0800, in... at rotnetix.com > > wrote: > > > I am curious as to how easy it will be for me to create a different > > mapping > > > for PGArray, so that instead of (PGArray (PGArray PGFloat8)) -> > > [[Double]] > > > I can do (PGArray (PGArray Float8)) -> Matrix Double. It is not a big > > deal > > > to do the conversion later but if the library allows that kind of thing > > to > > > be easily done it can make the code more readable. > > > > Sure, you could do it by adding a QueryRunnerDefault instance or just a > > QueryRunner instance for a compound type like the FromRow instance for > > IIM. > > > > Tom > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskel... at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Sat Jan 3 11:44:18 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Sat, 3 Jan 2015 11:44:18 +0000 Subject: [Haskell-cafe] threepenny-gui: garbage collection In-Reply-To: References: <20150103005739.GA21812@weber> Message-ID: <20150103114418.GA23099@weber> On Sat, Jan 03, 2015 at 11:34:07AM +0100, Heinrich Apfelmus wrote: > Tom Ellis wrote: > >Suppose that each time I make a particular threepenny-gui widget, call it a > >`Foo`, I register an event handler using `on` so that the `Foo` can change > >its appearance based on some `Event`. > > > >Suppose I create, show, and hide a billion `Foo`s, each one never to be > >shown again. Can they be garbage collected? Presumably there is something > >storing the callback that was registered for the `Event` and the callback > >refers to the `Foo`. How then can the `Foo`s be freed? > > > >`Reactive.Threepenny.register` talks about an "unregister" action but says > >"FIXME: Unregistering event handlers does not work yet.". But how could it > >be known anyway when to unregister? Is there not the possibility of a space > >leak regardless? > > (Threepenny author here.) > > This is a classic example of a circular reference that occurs in > every GUI program: A widget keeps a reference to an event handler, > which in turn keeps a reference to the widget. Hi Heinrich, thanks for your reply. Actually I don't think I am thinking of a circular reference problem. The problem I am evisaging is that the `Event` keeps a reference to the event handler which in turn keeps a reference to the widget. Thus it is hard to see how the widget can be freed before the `Event`. A quick Google shows this indeed a common problem in GUI programming, e.g. http://stackoverflow.com/questions/4526829/why-and-how-to-avoid-event-handler-memory-leaks Is my understanding correct, or is my model of how `Event`s work in threepenny-gui wrong? > Of course, GHC's has a well-designed garbage collector that can > handle this, but in Threepenny, the situation is actually worse: the > widget is managed by the JavaScript runtime, whereas the event > handler is managed by the Haskell runtime. I don't know any garbage > collector that can resolve cross-runtime circular dependencies. I haven't managed to understand the issue here. Could you say a bit more about that? It sounds interesting! I don't think it's related to my concern though, but if it is that would also be interesting. Tom From aditya.siram at gmail.com Sat Jan 3 14:59:09 2015 From: aditya.siram at gmail.com (aditya siram) Date: Sat, 3 Jan 2015 08:59:09 -0600 Subject: [Haskell-cafe] Class constraints on associated types ... In-Reply-To: References: Message-ID: Hi, That seemed to compile! I had no idea this kind of construction was even possible! However it did spew out a bunch of warnings like: "No explicit associated type or default declaration for ?Impl? in instance ..." Thanks! -deech On Fri, Jan 2, 2015 at 1:38 PM, Erik Hesselink wrote: > Could you do something like this? > > instance (Impl D1 D2 ~ a -> IO (), C a) => Dispatch D1 D2 > > Erik > > On Fri, Jan 2, 2015 at 7:59 PM, aditya siram > wrote: > > Hi all, > > I'd like to be able to constrain an associated type. > > > > I used to have an instance that looked like: > > class Dispatch a b c | a b -> c where > > runF :: a -> b -> c > > instance (C a) => Dispatch D1 D2 ( a -> IO ()) where > > runF d1 d2 = (\_ -> return ()) > > > > Since I upgraded to 7.8 from 7.5 that instance declaration is no longer > > accepted is no longer accepted since it violates FD's. > > > > I have been updating my code to use type families like so: > > class Dispatch a b where > > type Impl a b :: * > > runF :: a -> b -> Impl a b > > instance (C a) => Dispatch D1 D2 where > > type Impl D1 D2 = a -> IO () > > runF d1 d2 = (\_ return ()) > > > > Unfortunately the `type Impl ...` line in the instance is rejected > because > > it uses `a` on the RHS. > > > > In this one case I could just package it up into a newtype or something > but > > I would ideally like to be able to constrain any number of arguments > like: > > instance (C a, C b ... C z) => Dispatch D1 D2 where > > type Impl D1 D2 = a -> b -> ... -> z -> IO () > > ... > > > > This was something I could do in 7.6 (although I realize this is way > safer). > > How do I go about getting that constraint back? > > > > Thanks! > > -deech > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From contiver at itba.edu.ar Sat Jan 3 17:59:15 2015 From: contiver at itba.edu.ar (Cristian Ontivero) Date: Sat, 3 Jan 2015 14:59:15 -0300 Subject: [Haskell-cafe] Proof that scanl can be written as foldr? Message-ID: Hello, I'm trying to solve the exercise 4.6.5 of Bird's "Introduction to functional programming using Haskell". Let me quote: "Prove that scanl f e can be written as a foldr, if f is associative with unit e. Can scanl f e be written as a foldl without any assumptions on f and e?" So far reasoning by myself and googling a bit I reached to the following scanl definition using foldl (without any assumptions afaik): scanl f e = foldl (\xs next -> xs ++ [f (last xs) next]) [e] Furthermore, previously on the same chapter, it says that: scanl f e = foldr g [e] where g x xs = e : map (f x) xs Using this definition, I tried proving it by induction, but since I got stuck, I tried seeing if I could find some way to use the first duality theorem (with the foldl definition), or fusion, but to no avail. The induction proof I wrote is the following: scanl f e = foldr g [e] where g y ys = e : map (f y) ys By the principle of extensionality, this is equivalent to: scanl f e xs = foldr g [e] xs where g y ys = e : map (f y) ys We prove this equality by induction on xs. Case([]). For the left-hand side we reason scanl f e [] = {scanl.1} [e] For the right-hand side foldr g [e] [] = {foldr.1} [e] Case(x:xs). For the left-hand side we reason scanl f e (x:xs) = {scanl.2} e : scanl f (f e x) xs = {f has unit e} e : scanl f x xs = {induction hypothesis} e : foldr g [x] xs For the right-hand side foldr g [e] (x:xs) = {foldr.2} g x (foldr g [e] xs) = {definition of g} e : map (f x) (foldr g [e] xs) = {definition of map} e : foldr ((:) . (f x)) [] (foldr g [e] xs) I'm not even sure the last step is useful, but I thought maybe I could combine both foldrs into a single one (that's why I thought about the fusion law). Anyway, any help or pointer that can lead me in the right direction is very much appreciated. Thanks in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dedgrant at gmail.com Sat Jan 3 18:49:38 2015 From: dedgrant at gmail.com (Darren Grant) Date: Sat, 3 Jan 2015 10:49:38 -0800 Subject: [Haskell-cafe] Updating tar for ghc 7.10 FAM compatibility Message-ID: Hi all, Does anyone know who I can reach out to in order to get the tar hackage updated for ghc 7.10? Unfortunately, Duncan's email bounced. Cheers, Darren Grant -------------- next part -------------- An HTML attachment was scrubbed... URL: From aslatter at gmail.com Sat Jan 3 20:05:27 2015 From: aslatter at gmail.com (Antoine Latter) Date: Sat, 03 Jan 2015 20:05:27 +0000 Subject: [Haskell-cafe] Updating tar for ghc 7.10 FAM compatibility References: Message-ID: Let's try to CC Duncan on a different email address. On Sat Jan 03 2015 at 12:49:49 PM Darren Grant wrote: > Hi all, > > Does anyone know who I can reach out to in order to get the tar hackage > updated for ghc 7.10? Unfortunately, Duncan's email bounced. > > Cheers, > Darren Grant > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tdammers at gmail.com Sat Jan 3 21:21:04 2015 From: tdammers at gmail.com (Tobias Dammers) Date: Sat, 3 Jan 2015 22:21:04 +0100 Subject: [Haskell-cafe] ECMA262 (Javascript) interpreter In-Reply-To: References: Message-ID: <20150103212103.GA20402@yemaya> Hi again; I took a short look, and I think this looks like a promising candidate. The things I'd miss the most at this point would be: one, splitting the project up into a library and a CLI interpreter, so that it can be embedded into a Haskell host application without further ado; two, putting it on hackage (minor concern right now, but if at any time I choose to publish my project, I don't want to depend on anything that's not readily available through cabal); and three, a tiny bit more documentation, or even just a few usage examples. I'd be willing to help out with either if you're interested. Cheers, Tobias On Sun, Dec 07, 2014 at 03:48:47PM +1000, Fabian Bergmark wrote: > I have been implementing an ECMA-262 (Javascript) interpreter over the > last few weeks. I have been following > http://www.ecma-international.org/ecma-262/5.1 and tried to keep my > implementation as close to the specification as possible. > > The code can be found here https://github.com/fabianbergmark/ECMA-262 > > So far I have implemented the core language, but has yet to write all > the specification functions (Array.splice, String.substring etc.). > Before I do this and release it on hackage, I would appreciate > feedback on my implementation. > > The issues I see at the time are: > > * The parser is slow for deeply nested code > * Strict mode is not implemented > * Interpret.hs is ~ 6k lines > * SubType.hs uses IncoherentInstances, and a better implementation > would be nice. At the moment it works but for one case. > > To test the code, install the cabal package and run ecma262 on a .js > file. One host object, console.log is provided and prints to stdout. > > Fabian Bergmark > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From tobias.pflug at gmx.net Sat Jan 3 22:25:37 2015 From: tobias.pflug at gmx.net (Tobias Pflug) Date: Sat, 03 Jan 2015 23:25:37 +0100 Subject: [Haskell-cafe] ghc-mod split feature Message-ID: <54A86C61.9060303@gmx.net> Hi, i just wanted to try some of the ghcmod features that I haven't used before in order to hopefully add them to my vim haskell workflow somehow. What I apparently can't get to work is the split command: $ ghc-mod split src/Foo.hs Foo 47 7 which points to exactly the code listed in the ghc-mod help: f :: [a] -> a f x = _ It does however not yield any output at all. Am I missing something obvious here ? I'm using version 5.2.1.1 Thanks, Tobi From matthewtpickering at gmail.com Sun Jan 4 01:30:23 2015 From: matthewtpickering at gmail.com (Matthew Pickering) Date: Sun, 4 Jan 2015 01:30:23 +0000 Subject: [Haskell-cafe] servant-pandoc Message-ID: Dear list, As a quick and easy way to render API documentation to many more formats I thought it wise to create a new pandoc renderer. For those who don't know, pandoc is a multi-format document conversion tool which currently supports 24 different output formats.[1] The rendering is quite faithful to the current `markdown` renderer, if people find this package useful then I can look to fine tune the representation. Note: The package will not build until servant-docs 0.3 is released which will hopefully be tomorrow or the day after. Below are some examples of the rendering and links to the package. examples: https://github.com/mpickering/servant-pandoc/tree/master/examples github: https://github.com/mpickering/servant-pandoc hackage: http://hackage.haskell.org/package/servant-pandoc [1]: http://pandoc.org/ Matt From matthewtpickering at gmail.com Sun Jan 4 01:44:59 2015 From: matthewtpickering at gmail.com (Matthew Pickering) Date: Sun, 4 Jan 2015 01:44:59 +0000 Subject: [Haskell-cafe] servant-pandoc In-Reply-To: References: Message-ID: Apologies, this was sent to the wrong list. On Sun, Jan 4, 2015 at 1:30 AM, Matthew Pickering wrote: > Dear list, > > As a quick and easy way to render API documentation to many more > formats I thought it wise to create a new pandoc renderer. For those > who don't know, pandoc is a multi-format document conversion tool > which currently supports 24 different output formats.[1] The rendering > is quite faithful to the current `markdown` renderer, if people find > this package useful then I can look to fine tune the representation. > > Note: The package will not build until servant-docs 0.3 is released > which will hopefully be tomorrow or the day after. > > Below are some examples of the rendering and links to the package. > > examples: https://github.com/mpickering/servant-pandoc/tree/master/examples > > github: https://github.com/mpickering/servant-pandoc > hackage: http://hackage.haskell.org/package/servant-pandoc > > [1]: http://pandoc.org/ > > Matt From fabian.bergmark at gmail.com Sun Jan 4 12:10:41 2015 From: fabian.bergmark at gmail.com (Fabian Bergmark) Date: Sun, 4 Jan 2015 13:10:41 +0100 Subject: [Haskell-cafe] ECMA262 (Javascript) interpreter In-Reply-To: <20150103212103.GA20402@yemaya> References: <20150103212103.GA20402@yemaya> Message-ID: The package is available on hackage. I think its a good idea to split the cli into a separate package, ecma262-cli. I will update the documentation in the next version. If anyone would like to help me implement all the spec functions we could release a version 1 soon. l?rdag 3 januari 2015 skrev Tobias Dammers : > Hi again; > > I took a short look, and I think this looks like a promising candidate. > The things I'd miss the most at this point would be: one, splitting the > project up into a library and a CLI interpreter, so that it can be > embedded into a Haskell host application without further ado; two, > putting it on hackage (minor concern right now, but if at any time I > choose to publish my project, I don't want to depend on anything that's > not readily available through cabal); and three, a tiny bit more > documentation, or even just a few usage examples. > > I'd be willing to help out with either if you're interested. > > Cheers, > > Tobias > > On Sun, Dec 07, 2014 at 03:48:47PM +1000, Fabian Bergmark wrote: > > I have been implementing an ECMA-262 (Javascript) interpreter over the > > last few weeks. I have been following > > http://www.ecma-international.org/ecma-262/5.1 and tried to keep my > > implementation as close to the specification as possible. > > > > The code can be found here https://github.com/fabianbergmark/ECMA-262 > > > > So far I have implemented the core language, but has yet to write all > > the specification functions (Array.splice, String.substring etc.). > > Before I do this and release it on hackage, I would appreciate > > feedback on my implementation. > > > > The issues I see at the time are: > > > > * The parser is slow for deeply nested code > > * Strict mode is not implemented > > * Interpret.hs is ~ 6k lines > > * SubType.hs uses IncoherentInstances, and a better implementation > > would be nice. At the moment it works but for one case. > > > > To test the code, install the cabal package and run ecma262 on a .js > > file. One host object, console.log is provided and prints to stdout. > > > > Fabian Bergmark > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yo.eight at gmail.com Sun Jan 4 12:24:46 2015 From: yo.eight at gmail.com (Yorick Laupa) Date: Sun, 04 Jan 2015 13:24:46 +0100 Subject: [Haskell-cafe] [ANN] Haskell client for Event Store Message-ID: <54A9310E.6070505@gmail.com> Hi, I'd like to announce my Event Store TCP client. It licensed under BSD3. You can find the source on Github . Package is available on Hackage . Here's a list of supported features: * Single event writes. * Batch writes. * Transactional writes. * Stream deletion. * Single event reads. * Range reads from regular streams and from $all stream (backward and forward). * Volatile subscriptions (regular stream and $all). * Catch-up subscriptions (regular stream and $all). * Authenticated connection. Will be implemented: * Persistent subscriptions. * SSL connection. I originally wrote that library because I need it for a real project. I only implemented features I need first, so feel free to open a ticket (or better a pull request) on Github for something you need or a bug you've experienced. I'll be as fast as I can. Few notes on the code itself. This implementation uses a Functional Reactive Programming (FRP) library named Sodium . Connection bookkeeping (operation and subscription management for instance) was amazingly easy to implement with it. I only tested that library with EventStore 3.0.1. Hope you enjoy it. Regards, Yorick -------------- next part -------------- An HTML attachment was scrubbed... URL: From aditya.siram at gmail.com Sun Jan 4 14:33:42 2015 From: aditya.siram at gmail.com (aditya siram) Date: Sun, 4 Jan 2015 08:33:42 -0600 Subject: [Haskell-cafe] Class constraints on associated types ... In-Reply-To: References: Message-ID: Hi, Unfortunately while this compiles it does not work correctly. For example the code: data D1 data D2 class Dispatch a b where type Impl_ a b :: * runF :: a -> b -> Impl_ a b instance (Show a, Impl_ D1 D2 ~ (a -> IO ())) => Dispatch D1 D2 where runF _ _ = print compiles with the warning: No explicit associated type or default declaration for ?Impl_? In the instance declaration for ?Dispatch D1 D2? But however when I run it I see that the type function does not resolve: *Main> runF (undefined :: D1) (undefined :: D2) :8:1: Couldn't match expected type ?a0 -> IO ()? with actual type ?Impl_ D1 D2? The type variable ?a0? is ambiguous In the first argument of ?print?, namely ?it? In a stmt of an interactive GHCi command: print it Thanks! -deech On Sat, Jan 3, 2015 at 8:59 AM, aditya siram wrote: > Hi, > That seemed to compile! I had no idea this kind of construction was even > possible! > > However it did spew out a bunch of warnings like: > "No explicit associated type or default declaration for ?Impl? in instance > ..." > > Thanks! > -deech > > On Fri, Jan 2, 2015 at 1:38 PM, Erik Hesselink > wrote: > >> Could you do something like this? >> >> instance (Impl D1 D2 ~ a -> IO (), C a) => Dispatch D1 D2 >> >> Erik >> >> On Fri, Jan 2, 2015 at 7:59 PM, aditya siram >> wrote: >> > Hi all, >> > I'd like to be able to constrain an associated type. >> > >> > I used to have an instance that looked like: >> > class Dispatch a b c | a b -> c where >> > runF :: a -> b -> c >> > instance (C a) => Dispatch D1 D2 ( a -> IO ()) where >> > runF d1 d2 = (\_ -> return ()) >> > >> > Since I upgraded to 7.8 from 7.5 that instance declaration is no longer >> > accepted is no longer accepted since it violates FD's. >> > >> > I have been updating my code to use type families like so: >> > class Dispatch a b where >> > type Impl a b :: * >> > runF :: a -> b -> Impl a b >> > instance (C a) => Dispatch D1 D2 where >> > type Impl D1 D2 = a -> IO () >> > runF d1 d2 = (\_ return ()) >> > >> > Unfortunately the `type Impl ...` line in the instance is rejected >> because >> > it uses `a` on the RHS. >> > >> > In this one case I could just package it up into a newtype or something >> but >> > I would ideally like to be able to constrain any number of arguments >> like: >> > instance (C a, C b ... C z) => Dispatch D1 D2 where >> > type Impl D1 D2 = a -> b -> ... -> z -> IO () >> > ... >> > >> > This was something I could do in 7.6 (although I realize this is way >> safer). >> > How do I go about getting that constraint back? >> > >> > Thanks! >> > -deech >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> > >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aditya.siram at gmail.com Sun Jan 4 14:39:55 2015 From: aditya.siram at gmail.com (aditya siram) Date: Sun, 4 Jan 2015 08:39:55 -0600 Subject: [Haskell-cafe] Class constraints on associated types ... In-Reply-To: References: Message-ID: As an interesting side-note, this code compiles and does not issue a warning: instance (Show a, Impl_ D1 D2 ~ (a -> IO ())) => Dispatch D1 D2 where type Impl_ D1 D2 = Impl_ D1 D2 runF _ _ = print And even seems to resolve correctly: *Main> runF (undefined :: D1) (undefined :: D2) :11:1: No instance for (Show (a0 -> IO ())) arising from a use of ?print? In a stmt of an interactive GHCi command: print it But when I run it the REPL goes into an infinite loop: *Main> runF (undefined :: D1) (undefined :: D2) 1 *** Exception: <> -deech On Sun, Jan 4, 2015 at 8:33 AM, aditya siram wrote: > Hi, > Unfortunately while this compiles it does not work correctly. For example > the code: > data D1 > data D2 > class Dispatch a b where > type Impl_ a b :: * > runF :: a -> b -> Impl_ a b > instance (Show a, Impl_ D1 D2 ~ (a -> IO ())) => Dispatch D1 D2 where > runF _ _ = print > > compiles with the warning: > No explicit associated type or default declaration for ?Impl_? > In the instance declaration for ?Dispatch D1 D2? > > But however when I run it I see that the type function does not resolve: > *Main> runF (undefined :: D1) (undefined :: D2) > > :8:1: > Couldn't match expected type ?a0 -> IO ()? > with actual type ?Impl_ D1 D2? > The type variable ?a0? is ambiguous > In the first argument of ?print?, namely ?it? > In a stmt of an interactive GHCi command: print it > > Thanks! > -deech > > > > > On Sat, Jan 3, 2015 at 8:59 AM, aditya siram > wrote: > >> Hi, >> That seemed to compile! I had no idea this kind of construction was even >> possible! >> >> However it did spew out a bunch of warnings like: >> "No explicit associated type or default declaration for ?Impl? in >> instance ..." >> >> Thanks! >> -deech >> >> On Fri, Jan 2, 2015 at 1:38 PM, Erik Hesselink >> wrote: >> >>> Could you do something like this? >>> >>> instance (Impl D1 D2 ~ a -> IO (), C a) => Dispatch D1 D2 >>> >>> Erik >>> >>> On Fri, Jan 2, 2015 at 7:59 PM, aditya siram >>> wrote: >>> > Hi all, >>> > I'd like to be able to constrain an associated type. >>> > >>> > I used to have an instance that looked like: >>> > class Dispatch a b c | a b -> c where >>> > runF :: a -> b -> c >>> > instance (C a) => Dispatch D1 D2 ( a -> IO ()) where >>> > runF d1 d2 = (\_ -> return ()) >>> > >>> > Since I upgraded to 7.8 from 7.5 that instance declaration is no longer >>> > accepted is no longer accepted since it violates FD's. >>> > >>> > I have been updating my code to use type families like so: >>> > class Dispatch a b where >>> > type Impl a b :: * >>> > runF :: a -> b -> Impl a b >>> > instance (C a) => Dispatch D1 D2 where >>> > type Impl D1 D2 = a -> IO () >>> > runF d1 d2 = (\_ return ()) >>> > >>> > Unfortunately the `type Impl ...` line in the instance is rejected >>> because >>> > it uses `a` on the RHS. >>> > >>> > In this one case I could just package it up into a newtype or >>> something but >>> > I would ideally like to be able to constrain any number of arguments >>> like: >>> > instance (C a, C b ... C z) => Dispatch D1 D2 where >>> > type Impl D1 D2 = a -> b -> ... -> z -> IO () >>> > ... >>> > >>> > This was something I could do in 7.6 (although I realize this is way >>> safer). >>> > How do I go about getting that constraint back? >>> > >>> > Thanks! >>> > -deech >>> > >>> > _______________________________________________ >>> > Haskell-Cafe mailing list >>> > Haskell-Cafe at haskell.org >>> > http://www.haskell.org/mailman/listinfo/haskell-cafe >>> > >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vogt.adam at gmail.com Sun Jan 4 19:46:56 2015 From: vogt.adam at gmail.com (adam vogt) Date: Sun, 4 Jan 2015 14:46:56 -0500 Subject: [Haskell-cafe] Class constraints on associated types ... In-Reply-To: References: Message-ID: On Fri, Jan 2, 2015 at 1:59 PM, aditya siram wrote: > Since I upgraded to 7.8 from 7.5 that instance declaration is no longer > accepted is no longer accepted since it violates FD's. There is a patch adding a -XDysfunctionalDependencies extension here . It looks like it didn't make it into 7.10 From johan.tibell at gmail.com Sun Jan 4 23:24:44 2015 From: johan.tibell at gmail.com (Johan Tibell) Date: Sun, 4 Jan 2015 18:24:44 -0500 Subject: [Haskell-cafe] ANN: Cabal 1.22 and cabal-install 1.22 Message-ID: On behalf of the cabal developers, I'm happy to announce the Cabal 1.22 release! To install: cabal update && cabal install Cabal-1.22.0.0 cabal-install-1.22.0.0 Please report bugs at https://github.com/haskell/cabal/issues. Pre-built binaries should be available with a week or so. Non-exhaustive list of changes: * Support GHC 7.10. * Experimental DWARF debug info output on GHC 7.10 (--enable-debug-info). * Preliminary support for relocatable packages. * Cabal can now be used inside a cabal exec environment. * Fix solver bug where the user's manual flag choice was ignored. * Add GHCJS support. * Improved command line documentation. * Build C sources with -fPIC when GHC is using dynamic libraries. * Preliminary support for package keys (a step on the way to NixOS-like packages). * Add a 'user-config' command to help users manage ~/.cabal/config. * HPC support improved. Here are all the contributors to this release, ordered by number of commits: 181 Mikhail Glushenkov 48 Johan Tibell 35 Edward Z. Yang 34 Christiaan Baaij 32 Thomas Tuegel 24 Ben Armston 19 Ian D. Bollinger 17 Lennart Spitzner 12 Luite Stegeman 11 Herbert Valerio Riedel 10 Duncan Coutts 9 Erik de Castro Lopo 8 Andres Loeh 5 Chris Wong 5 Iain Nicol 5 Heather 5 Jake Wheat 4 Daniel Trstenjak 4 Tuncer Ayaz 4 Neil Vice 4 Rudy Matela 2 David Feuer 2 Bertram Felgenhauer 2 Fujimura Daisuke 2 Iustin Pop 2 John Chee 2 Keshav Kini 2 Maxwell Swadling 2 Michael Snoyman 2 Owen Stephens 2 Sergey Vinokurov 2 Thomas Miedema 2 Vincent Hanquez 2 jake 1 Brent Yorgey 1 Maximilian Tagher 1 Anton Dessiatov 1 phischu 1 Bob Ippolito 1 Mi?tek Bak 1 Bardur Arantsson 1 Nikita Karetnikov 1 tchakkazulu 1 Peter Tr?ko 1 Austin Seipp 1 Ryan Mulligan 1 RyanGlScott 1 Samuel G?lineau 1 Sergei Trofimovich 1 jpmoresmau 1 Simon Hengel 1 Thomas M. DuBuisson 1 Harry Garrood 1 Isamu Mogi 1 kosmikus 1 David Fox 1 Curtis Gagliardi 1 Antonio Nikishaev 1 Karel Gardas 1 Travis Cardwell 1 Chris Allen 1 Matthew William Cox -------------- next part -------------- An HTML attachment was scrubbed... URL: From gongchuo.lu at gmail.com Sun Jan 4 23:15:28 2015 From: gongchuo.lu at gmail.com (Jimmy Lu) Date: Sun, 04 Jan 2015 18:15:28 -0500 Subject: [Haskell-cafe] hxt: How to Unpickle Multiple Adjacent Elements Message-ID: <874ms69lyn.fsf@kudu.i-did-not-set--mail-host-address--so-tickle-me> Hi, With xml element having DTD like following: I want to unpickle the sequence hw, hsl?, (pr | altpr)?, (ahw, hsl?, (pr | altpr)?)* into Haskell data type [Headword] where data Headword = Hw { hwText :: String , hwSl :: Maybe String , hwPr :: Maybe Pronunciation } However in the hxt pickle API I cannot found a way to extract a sequence of adjacent elements. Is there any one knowing how to do it? Thanks, Jimmy Lu From gongchuo.lu at gmail.com Sun Jan 4 23:36:50 2015 From: gongchuo.lu at gmail.com (Jimmy Lu) Date: Sun, 04 Jan 2015 18:36:50 -0500 Subject: [Haskell-cafe] hxt: How to Unpickle Multiple Adjacent Elements Message-ID: <87h9w686el.fsf@kudu.i-did-not-set--mail-host-address--so-tickle-me> Hi, With xml element having DTD like following: I want to unpickle the sequence hw, hsl?, (pr | altpr)?, (ahw, hsl?, (pr | altpr)?)* into Haskell data type [Headword] where data Headword = Hw { hwText :: String , hwSl :: Maybe String , hwPr :: Maybe Pronunciation } However in the hxt pickle API I cannot found a way to extract a sequence of adjacent elements. Is there any one knowing how to do it? Thanks, Jimmy Lu From christian at ponies.io Mon Jan 5 05:12:20 2015 From: christian at ponies.io (Christian Marie) Date: Mon, 5 Jan 2015 16:12:20 +1100 Subject: [Haskell-cafe] ANN: git-vogue - a pre-commit check framework for haskell code quality Message-ID: <20150105051220.GA29535@cucumber.bridge.anchor.net.au> There are no standards in the Haskell community when it comes to IDEs and editors. As such we've found ourselves without a common benchmark for linting, formatting and code quality checks. Within our development team at Anchor, we wanted a tool that would: * Install in one command * Require nothing to be learned for a new developer * Tell that developer what they need to fix in the code that they modify. We wanted to to satisfy these needs, whilst saving developers from the drudgery of installing, configuring and running a suite of tools independently. Let's face it, if it's difficult to run the formatters and linters and not a part of your established work flow, some developers just aren't going to bother. We built such a tool: http://anchor.github.io/git-vogue/ To install and configure, just: cabal install git-vogue # Wait 15 minutes cd your-project git vogue init All staged files will now be checked on pre-commit. If you wish to check the whole repo: git vogue check --all You can automatically apply stylish-haskell fixes to staged files: git vouge fix Or the whole repo: git vogue fix --all Thank you to thsutton, groberts, oswynb, glasnt, tranma, barneydesmond and sio for your development efforts, and everyone who has taken the time to test and provide feedback. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From alex.gaziev at gmail.com Mon Jan 5 07:04:37 2015 From: alex.gaziev at gmail.com (Alex Gaziev) Date: Mon, 5 Jan 2015 15:04:37 +0800 Subject: [Haskell-cafe] Small language with parser in Haskell and Faker Message-ID: Hi all! As for beginner ? it was pretty hard to me to parse YAML or JSON. Too much information, too much functions for such a simple task (in Ruby it is really simple, because of duck typing). So I wrote mine super simple language for data files ? Giml ? and two parsers for it ? in Ruby and in Haskell. Aim of this language - to be fast and so simple that you need only couple pages of code of any language without heavy dependencies to implement parser. Here is the manifest: https://github.com/gazay/giml. Parser in Haskell: https://github.com/gazay/gimlh It was written mostly for my library Faker, which was nicely discussed on reddit ( http://www.reddit.com/r/haskell/comments/2rb8ym/haskell_library_for_generating_fake_data/) so I have a lot of plans what to do in future with Faker. But I didn't present Giml anywhere and it will be really great if someone can take a look (there only couple pages of code) and tell me what can be improved, what can be rewritten in better way and so on. I didn't use Parsec for a reason in this library as I wanted to write my parser as clean of dependencies as possible, but maybe it will improve performance or something else? -------------- next part -------------- An HTML attachment was scrubbed... URL: From hesselink at gmail.com Mon Jan 5 10:10:55 2015 From: hesselink at gmail.com (Erik Hesselink) Date: Mon, 5 Jan 2015 11:10:55 +0100 Subject: [Haskell-cafe] Class constraints on associated types ... In-Reply-To: References: Message-ID: Ah, you're right, I was confused. You can't give an associated type like this (with the forall). The best I can think of is to use a GADT, something like this: {-# LANGUAGE TypeFamilies, MultiParamTypeClasses, GADTs #-} data D1 data D2 data Showable where Showable :: Show a => a -> Showable class Dispatch a b where type Impl_ a b :: * runF :: a -> b -> Impl_ a b instance Dispatch D1 D2 where type Impl_ D1 D2 = Showable -> IO () runF _ _ (Showable x) = print x Now you can run it like this: *Main> runF (undefined :: D1) (undefined :: D2) (Showable True) True Regards, Erik On Sun, Jan 4, 2015 at 3:33 PM, aditya siram wrote: > Hi, > Unfortunately while this compiles it does not work correctly. For example > the code: > data D1 > data D2 > class Dispatch a b where > type Impl_ a b :: * > runF :: a -> b -> Impl_ a b > instance (Show a, Impl_ D1 D2 ~ (a -> IO ())) => Dispatch D1 D2 where > runF _ _ = print > > compiles with the warning: > No explicit associated type or default declaration for ?Impl_? > In the instance declaration for ?Dispatch D1 D2? > > But however when I run it I see that the type function does not resolve: > *Main> runF (undefined :: D1) (undefined :: D2) > > :8:1: > Couldn't match expected type ?a0 -> IO ()? > with actual type ?Impl_ D1 D2? > The type variable ?a0? is ambiguous > In the first argument of ?print?, namely ?it? > In a stmt of an interactive GHCi command: print it > > Thanks! > -deech > > > > > On Sat, Jan 3, 2015 at 8:59 AM, aditya siram wrote: >> >> Hi, >> That seemed to compile! I had no idea this kind of construction was even >> possible! >> >> However it did spew out a bunch of warnings like: >> "No explicit associated type or default declaration for ?Impl? in instance >> ..." >> >> Thanks! >> -deech >> >> On Fri, Jan 2, 2015 at 1:38 PM, Erik Hesselink >> wrote: >>> >>> Could you do something like this? >>> >>> instance (Impl D1 D2 ~ a -> IO (), C a) => Dispatch D1 D2 >>> >>> Erik >>> >>> On Fri, Jan 2, 2015 at 7:59 PM, aditya siram >>> wrote: >>> > Hi all, >>> > I'd like to be able to constrain an associated type. >>> > >>> > I used to have an instance that looked like: >>> > class Dispatch a b c | a b -> c where >>> > runF :: a -> b -> c >>> > instance (C a) => Dispatch D1 D2 ( a -> IO ()) where >>> > runF d1 d2 = (\_ -> return ()) >>> > >>> > Since I upgraded to 7.8 from 7.5 that instance declaration is no longer >>> > accepted is no longer accepted since it violates FD's. >>> > >>> > I have been updating my code to use type families like so: >>> > class Dispatch a b where >>> > type Impl a b :: * >>> > runF :: a -> b -> Impl a b >>> > instance (C a) => Dispatch D1 D2 where >>> > type Impl D1 D2 = a -> IO () >>> > runF d1 d2 = (\_ return ()) >>> > >>> > Unfortunately the `type Impl ...` line in the instance is rejected >>> > because >>> > it uses `a` on the RHS. >>> > >>> > In this one case I could just package it up into a newtype or something >>> > but >>> > I would ideally like to be able to constrain any number of arguments >>> > like: >>> > instance (C a, C b ... C z) => Dispatch D1 D2 where >>> > type Impl D1 D2 = a -> b -> ... -> z -> IO () >>> > ... >>> > >>> > This was something I could do in 7.6 (although I realize this is way >>> > safer). >>> > How do I go about getting that constraint back? >>> > >>> > Thanks! >>> > -deech >>> > >>> > _______________________________________________ >>> > Haskell-Cafe mailing list >>> > Haskell-Cafe at haskell.org >>> > http://www.haskell.org/mailman/listinfo/haskell-cafe >>> > >> >> > From hesselink at gmail.com Mon Jan 5 10:25:27 2015 From: hesselink at gmail.com (Erik Hesselink) Date: Mon, 5 Jan 2015 11:25:27 +0100 Subject: [Haskell-cafe] hxt: How to Unpickle Multiple Adjacent Elements In-Reply-To: <874ms69lyn.fsf@kudu.i-did-not-set--mail-host-address--so-tickle-me> References: <874ms69lyn.fsf@kudu.i-did-not-set--mail-host-address--so-tickle-me> Message-ID: Hi Jimmy, Doesn't xpPair [0] do what you want? Then afterwards, use `xpWrap` to convert the pair(s) to your custom data type. Erik [0] http://hackage.haskell.org/package/hxt-9.3.1.10/docs/Text-XML-HXT-Arrow-Pickle-Xml.html#v:xpPair On Mon, Jan 5, 2015 at 12:15 AM, Jimmy Lu wrote: > Hi, > > With xml element having DTD like following: > > > > I want to unpickle the sequence > > hw, hsl?, (pr | altpr)?, (ahw, hsl?, (pr | altpr)?)* > > into Haskell data type [Headword] where > > data Headword = Hw { hwText :: String > , hwSl :: Maybe String > , hwPr :: Maybe Pronunciation > } > > However in the hxt pickle API I cannot found a way to extract a sequence > of adjacent elements. Is there any one knowing how to do it? > > Thanks, > > > Jimmy Lu > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From sean at functionaljobs.com Mon Jan 5 17:00:01 2015 From: sean at functionaljobs.com (Functional Jobs) Date: Mon, 5 Jan 2015 12:00:01 -0500 Subject: [Haskell-cafe] New Functional Programming Job Opportunities Message-ID: <54aac31392c36@functionaljobs.com> Here are some functional programming job opportunities that were posted recently: Senior Software Engineer at McGraw-Hill Education http://functionaljobs.com/jobs/8775-senior-software-engineer-at-mcgraw-hill-education Cheers, Sean Murphy FunctionalJobs.com From apfelmus at quantentunnel.de Mon Jan 5 17:31:57 2015 From: apfelmus at quantentunnel.de (Heinrich Apfelmus) Date: Mon, 05 Jan 2015 18:31:57 +0100 Subject: [Haskell-cafe] threepenny-gui: garbage collection In-Reply-To: <20150103114418.GA23099@weber> References: <20150103005739.GA21812@weber> <20150103114418.GA23099@weber> Message-ID: Tom Ellis wrote: > Heinrich Apfelmus wrote: >> Tom Ellis wrote: >>> >>> Suppose that each time I make a particular threepenny-gui widget, call it a >>> `Foo`, I register an event handler using `on` so that the `Foo` can change >>> its appearance based on some `Event`. >>> >>> Suppose I create, show, and hide a billion `Foo`s, each one never to be >>> shown again. Can they be garbage collected? Presumably there is something >>> storing the callback that was registered for the `Event` and the callback >>> refers to the `Foo`. How then can the `Foo`s be freed? >>> >>> [..] >> >> This is a classic example of a circular reference that occurs in >> every GUI program: A widget keeps a reference to an event handler, >> which in turn keeps a reference to the widget. > > Hi Heinrich, thanks for your reply. > > Actually I don't think I am thinking of a circular reference problem. The > problem I am envisaging is that the `Event` keeps a reference to the event > handler which in turn keeps a reference to the widget. Thus it is hard to > see how the widget can be freed before the `Event`. A quick Google shows > this indeed a common problem in GUI programming, e.g. > > http://stackoverflow.com/questions/4526829/why-and-how-to-avoid-event-handler-memory-leaks Consider this: Who keeps a reference to the `Event`? (If no one keeps a reference to the `Event`, then it can be garbage collected, and so can the event handler and the widget.) > Is my understanding correct, or is my model of how `Event`s work in > threepenny-gui wrong? > >> Of course, GHC's has a well-designed garbage collector that can >> handle this, but in Threepenny, the situation is actually worse: the >> widget is managed by the JavaScript runtime, whereas the event >> handler is managed by the Haskell runtime. I don't know any garbage >> collector that can resolve cross-runtime circular dependencies. > > I haven't managed to understand the issue here. Could you say a bit more > about that? It sounds interesting! I don't think it's related to my > concern though, but if it is that would also be interesting. The issue is still that there is a circular dependency widget -> Event -> event handler -> widget Now, this wouldn't be a problem if all these references were managed by GHC. Our beloved Haskell compiler can handle circular references just fine, they will be garbage collected at once whenever there is no more "outside" reference to the whole cycle. The real issue, which is specific to Threepenny, is that not all references are managed by GHC. Instead, some are managed by the JavaScript engine in the browser. In other words, the circular dependency crosses language boundaries -- and now it becomes hard to garbage collect it. Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Mon Jan 5 17:37:08 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Mon, 5 Jan 2015 17:37:08 +0000 Subject: [Haskell-cafe] threepenny-gui: garbage collection In-Reply-To: References: <20150103005739.GA21812@weber> <20150103114418.GA23099@weber> Message-ID: <20150105173708.GD27654@weber> On Mon, Jan 05, 2015 at 06:31:57PM +0100, Heinrich Apfelmus wrote: > Tom Ellis wrote: > >Heinrich Apfelmus wrote: > >>Tom Ellis wrote: > >>> > >>>Suppose that each time I make a particular threepenny-gui widget, call it a > >>>`Foo`, I register an event handler using `on` so that the `Foo` can change > >>>its appearance based on some `Event`. > >>> > >>>Suppose I create, show, and hide a billion `Foo`s, each one never to be > >>>shown again. Can they be garbage collected? Presumably there is something > >>>storing the callback that was registered for the `Event` and the callback > >>>refers to the `Foo`. How then can the `Foo`s be freed? > >>> > >>>[..] > >> > >>This is a classic example of a circular reference that occurs in > >>every GUI program: A widget keeps a reference to an event handler, > >>which in turn keeps a reference to the widget. > > > >Hi Heinrich, thanks for your reply. > > > >Actually I don't think I am thinking of a circular reference problem. The > >problem I am envisaging is that the `Event` keeps a reference to the event > >handler which in turn keeps a reference to the widget. Thus it is hard to > >see how the widget can be freed before the `Event`. A quick Google shows > >this indeed a common problem in GUI programming, e.g. > > > > http://stackoverflow.com/questions/4526829/why-and-how-to-avoid-event-handler-memory-leaks > > Consider this: Who keeps a reference to the `Event`? > > (If no one keeps a reference to the `Event`, then it can be garbage > collected, and so can the event handler and the widget.) I am suggesting that the `Event` originates elsewhere, perhaps from some other widget that we wish to have a long life, but we want to attach short-lived widgets to it via event handlers. Can we do that without having to explicitly unregister the handlers when we want the short-lived widgets to be garbage collected? Tom From elliot.cameron at covenanteyes.com Mon Jan 5 21:11:32 2015 From: elliot.cameron at covenanteyes.com (Elliot Cameron) Date: Mon, 5 Jan 2015 16:11:32 -0500 (EST) Subject: [Haskell-cafe] Concurrency problems with mysql bindings? In-Reply-To: <1759550824.1677721.1420487746814.JavaMail.root@covenanteyes.com> Message-ID: <2136217878.1683472.1420492292607.JavaMail.root@covenanteyes.com> Hello Fellow Haskellers, I am not experienced with the FFI, but I have suspicions that Haskell's "mysql" package falls short in terms of its support for concurrency. A tiny bit of discussion has occurred here: https://github.com/bos/mysql/issues/11 Since it appears that "mysql" is the de-facto binding for MySQL (see reverse dependencies at http://www.stackage.org/package/mysql ), it seems that this lack has far-reaching effects on the Haskell ecosystem at large. What attracts many to Haskell is it's strengths in writing parallel /concurrent code, but it seems we lose this benefit when interacting with MySQL. I for one have a beautiful Haskell program using MySQL which I would love to push into production, but it's performance pales in comparison to a Python script that builds up calls to bash and actually achieves concurrency. At this point I have not been able to gain traction for this problem, and since I'm not an experienced Haskell developer, my contributions are slow and tedious. I'm hoping that I can garner some help in the following: 1) Confirm or deny my suspicions as represented in the issue linked above 2) If they are confirmed to any degree, I hope for some help in working through the solution Please let me know if you would like to help in either of these ways! Even the smallest comments will be highly valued! Elliot Cameron Covenant Eyes Software Developer elliot.cameron at covenanteyes.com 810-771-8322 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffbrown.the at gmail.com Mon Jan 5 21:56:49 2015 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Mon, 5 Jan 2015 13:56:49 -0800 Subject: [Haskell-cafe] Installing grapefruit: "lexical error at character 'i'" Message-ID: Dear list, I am trying to install grapefruit on Kubuntu 14.04. Most of the dependencies seemed to install without incident, but I am running into the following error: jeff at jeff-Lenovo:~$ cabal install grapefruit-ui-gtk grapefruit-examples Resolving dependencies... Configuring grapefruit-ui-0.1.0.5... Building grapefruit-ui-0.1.0.5... Preprocessing library grapefruit-ui-0.1.0.5... src/Internal/UIItem.hs-boot:12:2: lexical error at character 'i' Failed to install grapefruit-ui-0.1.0.5 cabal: Error: some packages failed to install: grapefruit-examples-0.1.0.5 depends on grapefruit-ui-0.1.0.5 which failed to install. grapefruit-ui-0.1.0.5 failed during the building phase. The exception was: ExitFailure 1 grapefruit-ui-gtk-0.1.0.5 depends on grapefruit-ui-0.1.0.5 which failed to install. jeff at jeff-Lenovo:~$ I wanted to find the offending 'i' character, but the file "src/Internal/UIItem.hs-boot" I was unable to find anywhere: jeff at jeff-Lenovo:/$ pwd / jeff at jeff-Lenovo:/$ sudo find . -name *UIItem.hs* [sudo] password for jeff: jeff at jeff-Lenovo:/$ Any ideas? Thanks, Jeff -------------- next part -------------- An HTML attachment was scrubbed... URL: From alan.zimm at gmail.com Mon Jan 5 21:58:52 2015 From: alan.zimm at gmail.com (Alan & Kim Zimmerman) Date: Mon, 5 Jan 2015 23:58:52 +0200 Subject: [Haskell-cafe] Installing grapefruit: "lexical error at character 'i'" In-Reply-To: References: Message-ID: In my experience that is a #if xxx without CPP enabled On Mon, Jan 5, 2015 at 11:56 PM, Jeffrey Brown wrote: > Dear list, > > I am trying to install grapefruit on Kubuntu 14.04. Most of the > dependencies seemed to install without incident, but I am running into the > following error: > > jeff at jeff-Lenovo:~$ cabal install grapefruit-ui-gtk grapefruit-examples > Resolving dependencies... > Configuring grapefruit-ui-0.1.0.5... > Building grapefruit-ui-0.1.0.5... > Preprocessing library grapefruit-ui-0.1.0.5... > src/Internal/UIItem.hs-boot:12:2: lexical error at character 'i' > Failed to install grapefruit-ui-0.1.0.5 > cabal: Error: some packages failed to install: > grapefruit-examples-0.1.0.5 depends on grapefruit-ui-0.1.0.5 which > failed to > install. > grapefruit-ui-0.1.0.5 failed during the building phase. The exception > was: > ExitFailure 1 > grapefruit-ui-gtk-0.1.0.5 depends on grapefruit-ui-0.1.0.5 which failed > to > install. > jeff at jeff-Lenovo:~$ > > I wanted to find the offending 'i' character, but the file > "src/Internal/UIItem.hs-boot" I was unable to find anywhere: > jeff at jeff-Lenovo:/$ pwd > / > jeff at jeff-Lenovo:/$ sudo find . -name *UIItem.hs* > [sudo] password for jeff: > jeff at jeff-Lenovo:/$ > > Any ideas? > > Thanks, > Jeff > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Mon Jan 5 22:00:17 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Mon, 5 Jan 2015 17:00:17 -0500 Subject: [Haskell-cafe] Installing grapefruit: "lexical error at character 'i'" In-Reply-To: References: Message-ID: On Mon, Jan 5, 2015 at 4:56 PM, Jeffrey Brown wrote: > I wanted to find the offending 'i' character, but the file > "src/Internal/UIItem.hs-boot" I was unable to find anywhere: > It won't be there, it was removed during cleanup from the failed install. Use "cabal get grapefruit-ui" to get a more permanent copy of the source. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffbrown.the at gmail.com Mon Jan 5 22:22:33 2015 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Mon, 5 Jan 2015 14:22:33 -0800 Subject: [Haskell-cafe] Installing grapefruit: "lexical error at character 'i'" In-Reply-To: References: Message-ID: Thanks guys! I found the library, though, as a .tar.gz file under /home/jeff/.cabal/packages/hackage.haskell.org/grapefruit-ui/0.1.0.5, and when I uncompressed that, found the UIItem file. I can't find the offending character in it, though. Supposedly it was at position 12.2 (line 12, column 2, right?), but I only see whitespace there. The first few lines of it are these ("module" being the first word of the first line): module Internal.UIItem ( -- * User interface items in general UIItem (UIItem), item, -- * Bricks Brick, brick, just, -- * Boxes Box, box, with, With (With), On Mon, Jan 5, 2015 at 2:00 PM, Brandon Allbery wrote: > On Mon, Jan 5, 2015 at 4:56 PM, Jeffrey Brown > wrote: > >> I wanted to find the offending 'i' character, but the file >> "src/Internal/UIItem.hs-boot" I was unable to find anywhere: >> > > It won't be there, it was removed during cleanup from the failed install. > Use "cabal get grapefruit-ui" to get a more permanent copy of the source. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffbrown.the at gmail.com Mon Jan 5 22:54:00 2015 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Mon, 5 Jan 2015 14:54:00 -0800 Subject: [Haskell-cafe] Installing grapefruit: "lexical error at character 'i'" In-Reply-To: References: Message-ID: I did not realize UIItem.hs and UIItem.hs-boot were separate things; I thank Matthew Pickering for pointing out that potential error in a private message. It looks like Alan or Kim was right: the 12th line of the boot file reads "#if MIN_VERSION_base(4,7,0)", and the file contains no mention of CPP. I am left with two questions: How to enable CPP? ------------------ Do I just include the following liine at the top of the boot file? {-# LANGUAGE CPP #-} How to replace the boot file? ----------------------------- In my hackage.haskell.org folder there are a lot of subfolders named after Haskell libraries -- arrows, cairo, etc. Almost every one of those includes in turn a single folder with a version number, and within that a .tar.gz file. In order to find the error you all helped me locate, I uncompressed the .tar.gz file in the grapefruit-ui folder. I could alter that object, but that does not seem likely to help, because I would not be altering the data that Haskell actually uses. Thanks! This is exciting! On Mon, Jan 5, 2015 at 2:22 PM, Jeffrey Brown wrote: > Thanks guys! > > I found the library, though, as a .tar.gz file under > /home/jeff/.cabal/packages/hackage.haskell.org/grapefruit-ui/0.1.0.5, and > when I uncompressed that, found the UIItem file. > > I can't find the offending character in it, though. Supposedly it was at > position 12.2 (line 12, column 2, right?), but I only see whitespace there. > The first few lines of it are these ("module" being the first word of the > first line): > > module Internal.UIItem ( > > -- * User interface items in general > UIItem (UIItem), > item, > > -- * Bricks > Brick, > brick, > just, > > -- * Boxes > Box, > box, > with, > With (With), > > On Mon, Jan 5, 2015 at 2:00 PM, Brandon Allbery > wrote: > >> On Mon, Jan 5, 2015 at 4:56 PM, Jeffrey Brown >> wrote: >> >>> I wanted to find the offending 'i' character, but the file >>> "src/Internal/UIItem.hs-boot" I was unable to find anywhere: >>> >> >> It won't be there, it was removed during cleanup from the failed install. >> Use "cabal get grapefruit-ui" to get a more permanent copy of the source. >> >> -- >> brandon s allbery kf8nh sine nomine >> associates >> allbery.b at gmail.com >> ballbery at sinenomine.net >> unix, openafs, kerberos, infrastructure, xmonad >> http://sinenomine.net >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffbrown.the at gmail.com Mon Jan 5 23:08:01 2015 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Mon, 5 Jan 2015 15:08:01 -0800 Subject: [Haskell-cafe] Installing grapefruit: "lexical error at character 'i'" In-Reply-To: References: Message-ID: Regarding replacing the boot-file, I thought I could delete the original .tar.gz file and replace it with one of my own. But that seems like it would only be a temporary fix -- would Cabal not discard that for a newer one every time I update, thus bringing back the problem? On Mon, Jan 5, 2015 at 2:54 PM, Jeffrey Brown wrote: > I did not realize UIItem.hs and UIItem.hs-boot were separate things; I > thank Matthew Pickering for pointing out that potential error in a private > message. > > It looks like Alan or Kim was right: the 12th line of the boot file reads > "#if MIN_VERSION_base(4,7,0)", and the file contains no mention of CPP. I > am left with two questions: > > How to enable CPP? > ------------------ > Do I just include the following liine at the top of the boot file? > {-# LANGUAGE CPP #-} > > How to replace the boot file? > ----------------------------- > In my hackage.haskell.org folder there are a lot of subfolders named > after Haskell libraries -- arrows, cairo, etc. Almost every one of those > includes in turn a single folder with a version number, and within that a > .tar.gz file. In order to find the error you all helped me locate, I > uncompressed the .tar.gz file in the grapefruit-ui folder. I could alter > that object, but that does not seem likely to help, because I would not be > altering the data that Haskell actually uses. > > Thanks! This is exciting! > > > On Mon, Jan 5, 2015 at 2:22 PM, Jeffrey Brown > wrote: > >> Thanks guys! >> >> I found the library, though, as a .tar.gz file under >> /home/jeff/.cabal/packages/hackage.haskell.org/grapefruit-ui/0.1.0.5, >> and when I uncompressed that, found the UIItem file. >> >> I can't find the offending character in it, though. Supposedly it was at >> position 12.2 (line 12, column 2, right?), but I only see whitespace there. >> The first few lines of it are these ("module" being the first word of the >> first line): >> >> module Internal.UIItem ( >> >> -- * User interface items in general >> UIItem (UIItem), >> item, >> >> -- * Bricks >> Brick, >> brick, >> just, >> >> -- * Boxes >> Box, >> box, >> with, >> With (With), >> >> On Mon, Jan 5, 2015 at 2:00 PM, Brandon Allbery >> wrote: >> >>> On Mon, Jan 5, 2015 at 4:56 PM, Jeffrey Brown >>> wrote: >>> >>>> I wanted to find the offending 'i' character, but the file >>>> "src/Internal/UIItem.hs-boot" I was unable to find anywhere: >>>> >>> >>> It won't be there, it was removed during cleanup from the failed >>> install. Use "cabal get grapefruit-ui" to get a more permanent copy of the >>> source. >>> >>> -- >>> brandon s allbery kf8nh sine nomine >>> associates >>> allbery.b at gmail.com >>> ballbery at sinenomine.net >>> unix, openafs, kerberos, infrastructure, xmonad >>> http://sinenomine.net >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rasen.dubi at gmail.com Mon Jan 5 23:37:00 2015 From: rasen.dubi at gmail.com (Alexey Shmalko) Date: Tue, 6 Jan 2015 01:37:00 +0200 Subject: [Haskell-cafe] Installing grapefruit: "lexical error at character 'i'" In-Reply-To: References: Message-ID: Hi, Probably, the best solution in this case (and most similar cases) is to send patch to upstream. I believe, grapefruit maintainers will be glad to see it. As far as I know, you can open a bug at http://trac.haskell.org/grapefruit/. Mailing list is also a nice place to try: http://projects.haskell.org/cgi-bin/mailman/listinfo/grapefruit Regards, Alexey 2015-01-06 1:08 GMT+02:00 Jeffrey Brown : > Regarding replacing the boot-file, I thought I could delete the original > .tar.gz file and replace it with one of my own. But that seems like it would > only be a temporary fix -- would Cabal not discard that for a newer one > every time I update, thus bringing back the problem? > > On Mon, Jan 5, 2015 at 2:54 PM, Jeffrey Brown > wrote: >> >> I did not realize UIItem.hs and UIItem.hs-boot were separate things; I >> thank Matthew Pickering for pointing out that potential error in a private >> message. >> >> It looks like Alan or Kim was right: the 12th line of the boot file reads >> "#if MIN_VERSION_base(4,7,0)", and the file contains no mention of CPP. I am >> left with two questions: >> >> How to enable CPP? >> ------------------ >> Do I just include the following liine at the top of the boot file? >> {-# LANGUAGE CPP #-} >> >> How to replace the boot file? >> ----------------------------- >> In my hackage.haskell.org folder there are a lot of subfolders named after >> Haskell libraries -- arrows, cairo, etc. Almost every one of those includes >> in turn a single folder with a version number, and within that a .tar.gz >> file. In order to find the error you all helped me locate, I uncompressed >> the .tar.gz file in the grapefruit-ui folder. I could alter that object, but >> that does not seem likely to help, because I would not be altering the data >> that Haskell actually uses. >> >> Thanks! This is exciting! >> >> >> On Mon, Jan 5, 2015 at 2:22 PM, Jeffrey Brown >> wrote: >>> >>> Thanks guys! >>> >>> I found the library, though, as a .tar.gz file under >>> /home/jeff/.cabal/packages/hackage.haskell.org/grapefruit-ui/0.1.0.5, and >>> when I uncompressed that, found the UIItem file. >>> >>> I can't find the offending character in it, though. Supposedly it was at >>> position 12.2 (line 12, column 2, right?), but I only see whitespace there. >>> The first few lines of it are these ("module" being the first word of the >>> first line): >>> >>> module Internal.UIItem ( >>> >>> -- * User interface items in general >>> UIItem (UIItem), >>> item, >>> >>> -- * Bricks >>> Brick, >>> brick, >>> just, >>> >>> -- * Boxes >>> Box, >>> box, >>> with, >>> With (With), >>> >>> On Mon, Jan 5, 2015 at 2:00 PM, Brandon Allbery >>> wrote: >>>> >>>> On Mon, Jan 5, 2015 at 4:56 PM, Jeffrey Brown >>>> wrote: >>>>> >>>>> I wanted to find the offending 'i' character, but the file >>>>> "src/Internal/UIItem.hs-boot" I was unable to find anywhere: >>>> >>>> >>>> It won't be there, it was removed during cleanup from the failed >>>> install. Use "cabal get grapefruit-ui" to get a more permanent copy of the >>>> source. >>>> >>>> -- >>>> brandon s allbery kf8nh sine nomine >>>> associates >>>> allbery.b at gmail.com >>>> ballbery at sinenomine.net >>>> unix, openafs, kerberos, infrastructure, xmonad >>>> http://sinenomine.net >>> >>> >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From jeffbrown.the at gmail.com Tue Jan 6 00:53:44 2015 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Mon, 5 Jan 2015 16:53:44 -0800 Subject: [Haskell-cafe] Installing grapefruit: "lexical error at character 'i'" In-Reply-To: References: Message-ID: Ah, of course. Thanks, Alexey! On Mon, Jan 5, 2015 at 3:37 PM, Alexey Shmalko wrote: > Hi, > > Probably, the best solution in this case (and most similar cases) is > to send patch to upstream. I believe, grapefruit maintainers will be > glad to see it. > > As far as I know, you can open a bug at > http://trac.haskell.org/grapefruit/. Mailing list is also a nice place > to try: http://projects.haskell.org/cgi-bin/mailman/listinfo/grapefruit > > Regards, > Alexey > > 2015-01-06 1:08 GMT+02:00 Jeffrey Brown : > > Regarding replacing the boot-file, I thought I could delete the original > > .tar.gz file and replace it with one of my own. But that seems like it > would > > only be a temporary fix -- would Cabal not discard that for a newer one > > every time I update, thus bringing back the problem? > > > > On Mon, Jan 5, 2015 at 2:54 PM, Jeffrey Brown > > wrote: > >> > >> I did not realize UIItem.hs and UIItem.hs-boot were separate things; I > >> thank Matthew Pickering for pointing out that potential error in a > private > >> message. > >> > >> It looks like Alan or Kim was right: the 12th line of the boot file > reads > >> "#if MIN_VERSION_base(4,7,0)", and the file contains no mention of CPP. > I am > >> left with two questions: > >> > >> How to enable CPP? > >> ------------------ > >> Do I just include the following liine at the top of the boot file? > >> {-# LANGUAGE CPP #-} > >> > >> How to replace the boot file? > >> ----------------------------- > >> In my hackage.haskell.org folder there are a lot of subfolders named > after > >> Haskell libraries -- arrows, cairo, etc. Almost every one of those > includes > >> in turn a single folder with a version number, and within that a .tar.gz > >> file. In order to find the error you all helped me locate, I > uncompressed > >> the .tar.gz file in the grapefruit-ui folder. I could alter that > object, but > >> that does not seem likely to help, because I would not be altering the > data > >> that Haskell actually uses. > >> > >> Thanks! This is exciting! > >> > >> > >> On Mon, Jan 5, 2015 at 2:22 PM, Jeffrey Brown > >> wrote: > >>> > >>> Thanks guys! > >>> > >>> I found the library, though, as a .tar.gz file under > >>> /home/jeff/.cabal/packages/hackage.haskell.org/grapefruit-ui/0.1.0.5, > and > >>> when I uncompressed that, found the UIItem file. > >>> > >>> I can't find the offending character in it, though. Supposedly it was > at > >>> position 12.2 (line 12, column 2, right?), but I only see whitespace > there. > >>> The first few lines of it are these ("module" being the first word of > the > >>> first line): > >>> > >>> module Internal.UIItem ( > >>> > >>> -- * User interface items in general > >>> UIItem (UIItem), > >>> item, > >>> > >>> -- * Bricks > >>> Brick, > >>> brick, > >>> just, > >>> > >>> -- * Boxes > >>> Box, > >>> box, > >>> with, > >>> With (With), > >>> > >>> On Mon, Jan 5, 2015 at 2:00 PM, Brandon Allbery > >>> wrote: > >>>> > >>>> On Mon, Jan 5, 2015 at 4:56 PM, Jeffrey Brown < > jeffbrown.the at gmail.com> > >>>> wrote: > >>>>> > >>>>> I wanted to find the offending 'i' character, but the file > >>>>> "src/Internal/UIItem.hs-boot" I was unable to find anywhere: > >>>> > >>>> > >>>> It won't be there, it was removed during cleanup from the failed > >>>> install. Use "cabal get grapefruit-ui" to get a more permanent copy > of the > >>>> source. > >>>> > >>>> -- > >>>> brandon s allbery kf8nh sine nomine > >>>> associates > >>>> allbery.b at gmail.com > >>>> ballbery at sinenomine.net > >>>> unix, openafs, kerberos, infrastructure, xmonad > >>>> http://sinenomine.net > >>> > >>> > >> > > > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From info at rotnetix.com Tue Jan 6 00:56:10 2015 From: info at rotnetix.com (info at rotnetix.com) Date: Mon, 5 Jan 2015 16:56:10 -0800 (PST) Subject: [Haskell-cafe] Postgresql Intervals with Opaleye In-Reply-To: <20150103105323.GB21812@weber> References: <20141230100323.GB11576@weber> <20150103105323.GB21812@weber> Message-ID: Got it kind of working, for some reason the interval type in my postgres instance does not correspond to the parser from kqr but i managed to implement a version that kind of works. More importantly the experience has been great for understanding how to do my own conversion types. Thanks for the help. On Saturday, January 3, 2015 9:53:31 PM UTC+11, Tom Ellis wrote: > > On Tue, Dec 30, 2014 at 04:59:29PM -0800, in... at rotnetix.com > wrote: > > That might be tricky... > > See https://github.com/lpsmith/postgresql-simple/pull/115, it seems > like > > it is not trivial to get the conversions to haskell types correct. > > > > Look like I am back to native SQL for that one. > > As lpsmith says here > > > https://github.com/lpsmith/postgresql-simple/pull/115#issuecomment-48754627 > > you can use the attached patch in your own code to get a conversion from > `interval` to `DiffTime`. It will have a few strange corner cases but you > will probably find you never hit them. > > Once you've done that you can make them suitable for Opaleye by writing > > data PGInterval > > instance QueryRunnerColumnDefault PGInterval DiffTime where > queryRunnerColumnDefault = fieldQueryRunnerColumn > > (you may have to import something from Opaleye.Internal.RunQuery). > > Please let me know how you get on with that, if you try it. > > Tom > _______________________________________________ > Haskell-Cafe mailing list > Haskel... at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From info at rotnetix.com Tue Jan 6 00:56:10 2015 From: info at rotnetix.com (info at rotnetix.com) Date: Mon, 5 Jan 2015 16:56:10 -0800 (PST) Subject: [Haskell-cafe] Postgresql Intervals with Opaleye In-Reply-To: <20150103105323.GB21812@weber> References: <20141230100323.GB11576@weber> <20150103105323.GB21812@weber> Message-ID: Got it kind of working, for some reason the interval type in my postgres instance does not correspond to the parser from kqr but i managed to implement a version that kind of works. More importantly the experience has been great for understanding how to do my own conversion types. Thanks for the help. On Saturday, January 3, 2015 9:53:31 PM UTC+11, Tom Ellis wrote: > > On Tue, Dec 30, 2014 at 04:59:29PM -0800, in... at rotnetix.com > wrote: > > That might be tricky... > > See https://github.com/lpsmith/postgresql-simple/pull/115, it seems > like > > it is not trivial to get the conversions to haskell types correct. > > > > Look like I am back to native SQL for that one. > > As lpsmith says here > > > https://github.com/lpsmith/postgresql-simple/pull/115#issuecomment-48754627 > > you can use the attached patch in your own code to get a conversion from > `interval` to `DiffTime`. It will have a few strange corner cases but you > will probably find you never hit them. > > Once you've done that you can make them suitable for Opaleye by writing > > data PGInterval > > instance QueryRunnerColumnDefault PGInterval DiffTime where > queryRunnerColumnDefault = fieldQueryRunnerColumn > > (you may have to import something from Opaleye.Internal.RunQuery). > > Please let me know how you get on with that, if you try it. > > Tom > _______________________________________________ > Haskell-Cafe mailing list > Haskel... at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brendan.g.hay at gmail.com Tue Jan 6 07:07:32 2015 From: brendan.g.hay at gmail.com (Brendan Hay) Date: Tue, 6 Jan 2015 20:07:32 +1300 Subject: [Haskell-cafe] Significant compilation slowdown when using Data.CaseInsensitive.mk Message-ID: Hi, I've recently run into an issue whereby changing textual case comparison to use the Data.CaseInsensitive.mk smart constructor causes substantial differences to outputted core language and a related compilation speed regression. The code which seems to cause this is here: https://github.com/brendanhay/amazonka/blob/release/0.1.4/core/src/Network/AWS/Data/Internal/Text.hs#L51 With the downstream project having about 68 call sites for the above function starting here: https://github.com/brendanhay/amazonka/blob/release/0.1.4/amazonka-ec2/gen/Network/AWS/EC2/Types.hs#L1465 For comparison, the previous version used Attoparsec.Text.takeText and Text values. Here are some hand wavy points of interest: * Before (Case Sensitive) Function: takeText = Attoparsec.Text.takeText Time (real): 2m27.735s amazonka-ec2/gen/Network/AWS/EC2/Types.hs (simpl): {terms: 242,688, types: 310,463, coercions: 31,215} * After (Case Insensitive) Function: takeCI = Data.CaseInsensitive.mk <$> Attoparsec.Text.takeText Time (real): 11m31.937s amazonka-ec2/gen/Network/AWS/EC2/Types.hs (simpl): {terms: 1,384,779, types: 465,656, coercions: 33,510} I'm finding the outputted core rather unwieldy to analyse, but the main difference seems to be the inclusion of huge swathes of case statements like: https://gist.github.com/brendanhay/5a57f073d5a7d196a1ad It would be appreciated if someone could help me to understand in simple terms why the use of case-insensitive causes this. -------------- next part -------------- An HTML attachment was scrubbed... URL: From magicloud.magiclouds at gmail.com Tue Jan 6 07:38:45 2015 From: magicloud.magiclouds at gmail.com (Magicloud Magiclouds) Date: Tue, 6 Jan 2015 15:38:45 +0800 Subject: [Haskell-cafe] May I have some examples on Kinds and Data.Type.Equality? Message-ID: Hi, I am trying to learn some advanced stuff of Haskell. But haskell wiki seems only giving some concepts and so. May I have some code example? Also other documents are welcomed. Thanks. -- ??????? ??????? And for G+, please use magiclouds#gmail.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rob at mars.org Tue Jan 6 08:27:09 2015 From: rob at mars.org (Rob Leslie) Date: Tue, 6 Jan 2015 00:27:09 -0800 Subject: [Haskell-cafe] Haskeline and asynchronous messages Message-ID: <5E00BA4A-D153-4C96-9C69-D3CAECAE8ACF@mars.org> Greetings, Does anyone have a suggestion on using Haskeline in an environment where another thread may be writing messages to the terminal -- is it possible to somehow print incoming messages above the input line without disturbing the input line? Thanks for any advice. -- Rob Leslie rob at mars.org From qdunkan at gmail.com Tue Jan 6 12:14:40 2015 From: qdunkan at gmail.com (Evan Laforge) Date: Tue, 6 Jan 2015 17:44:40 +0530 Subject: [Haskell-cafe] Haskeline and asynchronous messages In-Reply-To: <5E00BA4A-D153-4C96-9C69-D3CAECAE8ACF@mars.org> References: <5E00BA4A-D153-4C96-9C69-D3CAECAE8ACF@mars.org> Message-ID: I've done something like this by using Haskeline.MonadException.handle, and then using throwTo to interrupt Haskeline.getInputLine. Unfortunately it wipes out the contents of the input, so it wouldn't be very good for you, unless you can have haskeline save it. I too would like a way to interrupt and resume getInputLine without messing up its state. On Tue, Jan 6, 2015 at 1:57 PM, Rob Leslie wrote: > Greetings, > > Does anyone have a suggestion on using Haskeline in an environment where another thread may be writing messages to the terminal -- is it possible to somehow print incoming messages above the input line without disturbing the input line? > > Thanks for any advice. > > -- > Rob Leslie > rob at mars.org > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From allbery.b at gmail.com Tue Jan 6 13:58:45 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 6 Jan 2015 08:58:45 -0500 Subject: [Haskell-cafe] Haskeline and asynchronous messages In-Reply-To: <5E00BA4A-D153-4C96-9C69-D3CAECAE8ACF@mars.org> References: <5E00BA4A-D153-4C96-9C69-D3CAECAE8ACF@mars.org> Message-ID: On Tue, Jan 6, 2015 at 3:27 AM, Rob Leslie wrote: > Does anyone have a suggestion on using Haskeline in an environment where > another thread may be writing messages to the terminal -- is it possible to > somehow print incoming messages above the input line without disturbing the > input line? > Terminals don't really work that way; you need to be looking at something like curses or vty. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicholls.mark at vimn.com Tue Jan 6 17:43:47 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Tue, 6 Jan 2015 17:43:47 +0000 Subject: [Haskell-cafe] typeclass woes...how to constain a typeclass to be "closed" under an operation.... Message-ID: This is reposted from the beginnners?.I?ve not done Haskell for a while and was struggling to get anything to work, I?ve hopefully refound my feet. Its quite common in maths to have operations in a theory that are (set) closed, i just want to translate that notion to a typeclass I have a suggestion that does work class Foo m where op :: m a -> m (S a) That is closed, but now were working on types of kind ? -> ? (S can be a type family or a data type?lets say it?s a type family?.probably an associated type (if I know what that means)) Is this the idiom/pattern i should follow? Or can the closure contraint be expressed directly in a typeclass any other way? From: Haskell-Cafe [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Brandon Allbery Sent: 06 January 2015 1:59 PM To: Rob Leslie Cc: Haskell Cafe Subject: Re: [Haskell-cafe] Haskeline and asynchronous messages On Tue, Jan 6, 2015 at 3:27 AM, Rob Leslie > wrote: Does anyone have a suggestion on using Haskeline in an environment where another thread may be writing messages to the terminal -- is it possible to somehow print incoming messages above the input line without disturbing the input line? Terminals don't really work that way; you need to be looking at something like curses or vty. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rasen.dubi at gmail.com Tue Jan 6 17:55:24 2015 From: rasen.dubi at gmail.com (Alexey Shmalko) Date: Tue, 6 Jan 2015 19:55:24 +0200 Subject: [Haskell-cafe] typeclass woes...how to constain a typeclass to be "closed" under an operation.... In-Reply-To: References: Message-ID: I'm not sure, but can't closure constraint be expressed as: class Closed m where op :: m -> m Then class Closed is closed under operation op. Seems I'm missing something. Regards, Alexey 2015-01-06 19:43 GMT+02:00 Nicholls, Mark : > This is reposted from the beginnners?.I?ve not done Haskell for a while and > was struggling to get anything to work, I?ve hopefully refound my feet. > > > > Its quite common in maths to have operations in a theory that are (set) > closed, i just want to translate that notion to a typeclass > > > > I have a suggestion that does work > > > > class Foo m where > > op :: m a -> m (S a) > > > > That is closed, but now were working on types of kind ? -> ? > > > > (S can be a type family or a data type?lets say it?s a type family?.probably > an associated type (if I know what that means)) > > > > Is this the idiom/pattern i should follow? Or can the closure contraint be > expressed directly in a typeclass any other way? > > > > > > From: Haskell-Cafe [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of > Brandon Allbery > Sent: 06 January 2015 1:59 PM > To: Rob Leslie > Cc: Haskell Cafe > Subject: Re: [Haskell-cafe] Haskeline and asynchronous messages > > > > On Tue, Jan 6, 2015 at 3:27 AM, Rob Leslie wrote: > > Does anyone have a suggestion on using Haskeline in an environment where > another thread may be writing messages to the terminal -- is it possible to > somehow print incoming messages above the input line without disturbing the > input line? > > > > Terminals don't really work that way; you need to be looking at something > like curses or vty. > > > > -- > > brandon s allbery kf8nh sine nomine associates > > allbery.b at gmail.com ballbery at sinenomine.net > > unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net > > > > CONFIDENTIALITY NOTICE > > This e-mail (and any attached files) is confidential and protected by > copyright (and other intellectual property rights). If you are not the > intended recipient please e-mail the sender and then delete the email and > any attached files immediately. Any further use or dissemination is > prohibited. > > While MTV Networks Europe has taken steps to ensure that this email and any > attachments are virus free, it is your responsibility to ensure that this > message and any attachments are virus free and do not affect your systems / > data. > > Communicating by email is not 100% secure and carries risks such as delay, > data corruption, non-delivery, wrongful interception and unauthorised > amendment. If you communicate with us by e-mail, you acknowledge and assume > these risks, and you agree to take appropriate measures to minimise these > risks when e-mailing us. > > MTV Networks International, MTV Networks UK & Ireland, Greenhouse, > Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions > International, Be Viacom, Viacom International Media Networks and VIMN and > Comedy Central are all trading names of MTV Networks Europe. MTV Networks > Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks > Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, > London, NW1 8TT. > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Tue Jan 6 18:09:36 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Tue, 6 Jan 2015 18:09:36 +0000 Subject: [Haskell-cafe] typeclass woes...how to constain a typeclass to be "closed" under an operation.... In-Reply-To: References: Message-ID: <20150106180936.GJ30046@weber> On Tue, Jan 06, 2015 at 05:43:47PM +0000, Nicholls, Mark wrote: > Its quite common in maths to have operations in a theory that are (set) > closed, i just want to translate that notion to a typeclass Do you really need a typeclass (or indeed any way) of doing this? I suspect it will not work. If you consider the multiplication for the monoid of concatenation of lists (++) :: [a] -> [a] -> [a] you see that its type already implies that it is "closed". Tom From nicholls.mark at vimn.com Tue Jan 6 18:53:54 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Tue, 6 Jan 2015 18:53:54 +0000 Subject: [Haskell-cafe] typeclass woes...how to constain a typeclass to be "closed" under an operation.... In-Reply-To: <20150106180936.GJ30046@weber> References: <20150106180936.GJ30046@weber> Message-ID: I will post the question again properly tomorrow but your example indeed is almost a good example, but is trivially closed If the operation on monoid was [a]->[b]->[c] That is also closed; ie [c] is also a monoid.... And the typeclass declaration follows the idiom ive suggested This only works for types of kind *->* If i wanted to do this over a type of kind * (ignoring the trivial a->a) Can i express this in a typeclass? Please ignore until i resubmit this question Ps i hate phones Excuse the spelling, sent from a phone with itty bitty keys, it like trying to sow a button on a shirt with a sausage. >> On 6 Jan 2015, at 18:10, Tom Ellis wrote: >> >> On Tue, Jan 06, 2015 at 05:43:47PM +0000, Nicholls, Mark wrote: >> Its quite common in maths to have operations in a theory that are (set) >> closed, i just want to translate that notion to a typeclass > > Do you really need a typeclass (or indeed any way) of doing this? I suspect > it will not work. If you consider the multiplication for the monoid of > concatenation of lists > > (++) :: [a] -> [a] -> [a] > > you see that its type already implies that it is "closed". > > Tom > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. From nicholls.mark at vimn.com Tue Jan 6 19:03:19 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Tue, 6 Jan 2015 19:03:19 +0000 Subject: [Haskell-cafe] typeclass woes...how to constain a typeclass to be "closed" under an operation.... In-Reply-To: References: <20150106180936.GJ30046@weber> Message-ID: <3FDA2D12-040D-4155-B2BE-40E2BBDC0CD2@vimn.com> Bind on monad is a better example, its specified to be closed by the typeclass, but agajn operares on types of kind *->* if i have a function that orbits through multiple types (via type family) of kind * then i have to aggregate them under some wrapper type of kind *->* to define the set closed operation on the wrapper Hmmmmm As you can see i dont do much haskell, and im trying to get my head around how to map simple mathematical concepts into it Excuse the spelling, sent from a phone with itty bitty keys, it like trying to sow a button on a shirt with a sausage. > On 6 Jan 2015, at 18:53, Nicholls, Mark wrote: > > I will post the question again properly tomorrow but your example indeed is almost a good example, but is trivially closed > > If the operation on monoid was > > [a]->[b]->[c] > > That is also closed; ie [c] is also a monoid.... And the typeclass declaration follows the idiom ive suggested > > This only works for types of kind *->* > > If i wanted to do this over a type of kind * (ignoring the trivial a->a) > > Can i express this in a typeclass? > > Please ignore until i resubmit this question > > Ps i hate phones > > Excuse the spelling, sent from a phone with itty bitty keys, it like trying to sow a button on a shirt with a sausage. > > >>> On 6 Jan 2015, at 18:10, Tom Ellis wrote: >>> >>> On Tue, Jan 06, 2015 at 05:43:47PM +0000, Nicholls, Mark wrote: >>> Its quite common in maths to have operations in a theory that are (set) >>> closed, i just want to translate that notion to a typeclass >> >> Do you really need a typeclass (or indeed any way) of doing this? I suspect >> it will not work. If you consider the multiplication for the monoid of >> concatenation of lists >> >> (++) :: [a] -> [a] -> [a] >> >> you see that its type already implies that it is "closed". >> >> Tom >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. From vogt.adam at gmail.com Tue Jan 6 19:06:33 2015 From: vogt.adam at gmail.com (adam vogt) Date: Tue, 6 Jan 2015 14:06:33 -0500 Subject: [Haskell-cafe] typeclass woes...how to constain a typeclass to be "closed" under an operation.... In-Reply-To: References: <20150106180936.GJ30046@weber> Message-ID: Hi, You can constrain the result type to be in the same class by writing something like: {-# LANGUAGE UndecidableInstances, FlexibleInstances #-} {-# LANGUAGE TypeFamilies, FlexibleContexts #-} class Foo_ a -- just to prevent a cycle in superclass constraints instance Foo a => Foo_ a class Foo_ (S a) => Foo a where type S a op :: a -> (S a) -- and an example where you get a compile error if "op x" has an instance, -- but "op (op x)" does not have an instance. instance Foo Int where type S Int = Char op = toEnum instance Foo Char where type S Char = (Char,Char) op x = (x,x) instance Foo (Char,Char) where type S (Char,Char) = Int op (x,y) = fromEnum x On Tue, Jan 6, 2015 at 1:53 PM, Nicholls, Mark wrote: > I will post the question again properly tomorrow but your example indeed is almost a good example, but is trivially closed > > If the operation on monoid was > > [a]->[b]->[c] > > That is also closed; ie [c] is also a monoid.... And the typeclass declaration follows the idiom ive suggested > > This only works for types of kind *->* > > If i wanted to do this over a type of kind * (ignoring the trivial a->a) > > Can i express this in a typeclass? > > Please ignore until i resubmit this question > > Ps i hate phones > > Excuse the spelling, sent from a phone with itty bitty keys, it like trying to sow a button on a shirt with a sausage. > > >>> On 6 Jan 2015, at 18:10, Tom Ellis wrote: >>> >>> On Tue, Jan 06, 2015 at 05:43:47PM +0000, Nicholls, Mark wrote: >>> Its quite common in maths to have operations in a theory that are (set) >>> closed, i just want to translate that notion to a typeclass >> >> Do you really need a typeclass (or indeed any way) of doing this? I suspect >> it will not work. If you consider the multiplication for the monoid of >> concatenation of lists >> >> (++) :: [a] -> [a] -> [a] >> >> you see that its type already implies that it is "closed". >> >> Tom >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > CONFIDENTIALITY NOTICE > > This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. > > While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. > > Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. > > MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From nicholls.mark at vimn.com Tue Jan 6 19:14:46 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Tue, 6 Jan 2015 19:14:46 +0000 Subject: [Haskell-cafe] typeclass woes...how to constain a typeclass to be "closed" under an operation.... In-Reply-To: References: <20150106180936.GJ30046@weber> , Message-ID: <84490E6E-23EE-46A3-B1E3-82AC9EED9DD5@vimn.com> Oooo I'll have a go with this tomorrow Thanks Excuse the spelling, sent from a phone with itty bitty keys, it like trying to sow a button on a shirt with a sausage. > On 6 Jan 2015, at 19:06, adam vogt wrote: > > Hi, > > You can constrain the result type to be in the same class by writing > something like: > > {-# LANGUAGE UndecidableInstances, FlexibleInstances #-} > {-# LANGUAGE TypeFamilies, FlexibleContexts #-} > > class Foo_ a -- just to prevent a cycle in superclass constraints > instance Foo a => Foo_ a > > class Foo_ (S a) => Foo a where > type S a > op :: a -> (S a) > > -- and an example where you get a compile error if "op x" has an instance, > -- but "op (op x)" does not have an instance. > instance Foo Int where > type S Int = Char > op = toEnum > > instance Foo Char where > type S Char = (Char,Char) > op x = (x,x) > > instance Foo (Char,Char) where > type S (Char,Char) = Int > op (x,y) = fromEnum x > > >> On Tue, Jan 6, 2015 at 1:53 PM, Nicholls, Mark wrote: >> I will post the question again properly tomorrow but your example indeed is almost a good example, but is trivially closed >> >> If the operation on monoid was >> >> [a]->[b]->[c] >> >> That is also closed; ie [c] is also a monoid.... And the typeclass declaration follows the idiom ive suggested >> >> This only works for types of kind *->* >> >> If i wanted to do this over a type of kind * (ignoring the trivial a->a) >> >> Can i express this in a typeclass? >> >> Please ignore until i resubmit this question >> >> Ps i hate phones >> >> Excuse the spelling, sent from a phone with itty bitty keys, it like trying to sow a button on a shirt with a sausage. >> >> >>>> On 6 Jan 2015, at 18:10, Tom Ellis wrote: >>>> >>>> On Tue, Jan 06, 2015 at 05:43:47PM +0000, Nicholls, Mark wrote: >>>> Its quite common in maths to have operations in a theory that are (set) >>>> closed, i just want to translate that notion to a typeclass >>> >>> Do you really need a typeclass (or indeed any way) of doing this? I suspect >>> it will not work. If you consider the multiplication for the monoid of >>> concatenation of lists >>> >>> (++) :: [a] -> [a] -> [a] >>> >>> you see that its type already implies that it is "closed". >>> >>> Tom >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >> CONFIDENTIALITY NOTICE >> >> This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. >> >> While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. >> >> Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. >> >> MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. From nicholls.mark at vimn.com Tue Jan 6 19:18:15 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Tue, 6 Jan 2015 19:18:15 +0000 Subject: [Haskell-cafe] typeclass woes...how to constain a typeclass to be "closed" under an operation.... In-Reply-To: <84490E6E-23EE-46A3-B1E3-82AC9EED9DD5@vimn.com> References: <20150106180936.GJ30046@weber> , , <84490E6E-23EE-46A3-B1E3-82AC9EED9DD5@vimn.com> Message-ID: In fact i had tried somethjng very much like this but without the Foo_ and haskell wasnt happy with the cyclic definition So maybe this is the answer! I'll let you know Excuse the spelling, sent from a phone with itty bitty keys, it like trying to sow a button on a shirt with a sausage. > On 6 Jan 2015, at 19:14, Nicholls, Mark wrote: > > Oooo > > I'll have a go with this tomorrow > > Thanks > > Excuse the spelling, sent from a phone with itty bitty keys, it like trying to sow a button on a shirt with a sausage. > > >> On 6 Jan 2015, at 19:06, adam vogt wrote: >> >> Hi, >> >> You can constrain the result type to be in the same class by writing >> something like: >> >> {-# LANGUAGE UndecidableInstances, FlexibleInstances #-} >> {-# LANGUAGE TypeFamilies, FlexibleContexts #-} >> >> class Foo_ a -- just to prevent a cycle in superclass constraints >> instance Foo a => Foo_ a >> >> class Foo_ (S a) => Foo a where >> type S a >> op :: a -> (S a) >> >> -- and an example where you get a compile error if "op x" has an instance, >> -- but "op (op x)" does not have an instance. >> instance Foo Int where >> type S Int = Char >> op = toEnum >> >> instance Foo Char where >> type S Char = (Char,Char) >> op x = (x,x) >> >> instance Foo (Char,Char) where >> type S (Char,Char) = Int >> op (x,y) = fromEnum x >> >> >>> On Tue, Jan 6, 2015 at 1:53 PM, Nicholls, Mark wrote: >>> I will post the question again properly tomorrow but your example indeed is almost a good example, but is trivially closed >>> >>> If the operation on monoid was >>> >>> [a]->[b]->[c] >>> >>> That is also closed; ie [c] is also a monoid.... And the typeclass declaration follows the idiom ive suggested >>> >>> This only works for types of kind *->* >>> >>> If i wanted to do this over a type of kind * (ignoring the trivial a->a) >>> >>> Can i express this in a typeclass? >>> >>> Please ignore until i resubmit this question >>> >>> Ps i hate phones >>> >>> Excuse the spelling, sent from a phone with itty bitty keys, it like trying to sow a button on a shirt with a sausage. >>> >>> >>>>> On 6 Jan 2015, at 18:10, Tom Ellis wrote: >>>>> >>>>> On Tue, Jan 06, 2015 at 05:43:47PM +0000, Nicholls, Mark wrote: >>>>> Its quite common in maths to have operations in a theory that are (set) >>>>> closed, i just want to translate that notion to a typeclass >>>> >>>> Do you really need a typeclass (or indeed any way) of doing this? I suspect >>>> it will not work. If you consider the multiplication for the monoid of >>>> concatenation of lists >>>> >>>> (++) :: [a] -> [a] -> [a] >>>> >>>> you see that its type already implies that it is "closed". >>>> >>>> Tom >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>> CONFIDENTIALITY NOTICE >>> >>> This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. >>> >>> While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. >>> >>> Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. >>> >>> MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. From brendan.g.hay at gmail.com Tue Jan 6 20:09:19 2015 From: brendan.g.hay at gmail.com (Brendan Hay) Date: Wed, 7 Jan 2015 09:09:19 +1300 Subject: [Haskell-cafe] Significant compilation slowdown when using Data.CaseInsensitive.mk In-Reply-To: References: Message-ID: Apologies, I should have used SHA references in the links: > The code which seems to cause this is here: > https://github.com/brendanhay/amazonka/blob/release/0.1.4/core/src/Network/AWS/Data/Internal/Text.hs#L51 https://github.com/brendanhay/amazonka/blob/049fab83dd71e3f2e8aa5643902f95e83604db0c/core/src/Network/AWS/Data/Internal/Text.hs#L52 > With the downstream project having about 68 call sites for the above function starting here: > https://github.com/brendanhay/amazonka/blob/release/0.1.4/amazonka-ec2/gen/Network/AWS/EC2/Types.hs#L1465 https://github.com/brendanhay/amazonka/blob/04f620d3e01a05c30db99afa07a84d07eee12434/amazonka-ec2/gen/Network/AWS/EC2/Types.hs#L1465 On 6 January 2015 at 20:07, Brendan Hay wrote: > Hi, > > I've recently run into an issue whereby changing textual case comparison > to use the Data.CaseInsensitive.mk > smart > constructor causes substantial > differences to outputted core language and a related compilation speed > regression. > > The code which seems to cause this is here: > > https://github.com/brendanhay/amazonka/blob/release/0.1.4/core/src/Network/AWS/Data/Internal/Text.hs#L51 > > With the downstream project having about 68 call sites for the above > function starting here: > > https://github.com/brendanhay/amazonka/blob/release/0.1.4/amazonka-ec2/gen/Network/AWS/EC2/Types.hs#L1465 > > For comparison, the previous version used Attoparsec.Text.takeText > > and Text values. > > Here are some hand wavy points of interest: > > * Before (Case Sensitive) > Function: takeText = Attoparsec.Text.takeText > Time (real): 2m27.735s > amazonka-ec2/gen/Network/AWS/EC2/Types.hs (simpl): {terms: 242,688, types: > 310,463, coercions: 31,215} > > * After (Case Insensitive) > Function: takeCI = Data.CaseInsensitive.mk <$> Attoparsec.Text.takeText > Time (real): 11m31.937s > amazonka-ec2/gen/Network/AWS/EC2/Types.hs (simpl): {terms: 1,384,779, > types: 465,656, coercions: 33,510} > > I'm finding the outputted core rather unwieldy to analyse, but the main > difference seems to be the inclusion of huge swathes of case statements > like: > https://gist.github.com/brendanhay/5a57f073d5a7d196a1ad > > It would be appreciated if someone could help me to understand in simple > terms why > the use of case-insensitive causes this. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffbrown.the at gmail.com Wed Jan 7 01:06:32 2015 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Tue, 6 Jan 2015 17:06:32 -0800 Subject: [Haskell-cafe] Study GUI and FRP sequentially or concurrently? Superimposing graphics and text. Message-ID: Hi! I want to write a mindmapping app, like Freeplane, which involves drawing rectangles containing text and arrows connecting them. For that purpose, today I installed reactive-banana, wxWidgets, wxHaskell and reactive-banana-wx. (It's the first complex install for which I didn't have to write the list for help!) Am I correct that the question of whether graphics can be superimposed over text depends only on wxHaskell, and not reactive-banana? Would you recommend first writing code that uses only wxHaskell, to become familiar with the library, or jumping right in by using reactive-banana at the same time? Regards, Jeff -------------- next part -------------- An HTML attachment was scrubbed... URL: From tikhon at jelv.is Wed Jan 7 01:21:59 2015 From: tikhon at jelv.is (Tikhon Jelvis) Date: Tue, 6 Jan 2015 17:21:59 -0800 Subject: [Haskell-cafe] Study GUI and FRP sequentially or concurrently? Superimposing graphics and text. In-Reply-To: References: Message-ID: I personally picked up both wxHaskell and reactive-banana at the same time and it was fine. In practice the two are almost orthogonal?reactive-banana completely supplants parts of wx and doesn't touch the rest at all, for the most part. (I recall some wx-specific quirks that leak out into reactive-banana code, but nothing too bad.) For me, the examples included with reactive-banana-wx were probably the most useful learning aide. Once you figure out how the examples work, you can modify them and see the changes right away, which is enough of a stepping stone to figure the rest out from the API docs. As far as superimposing text on an image, that should only take wxHaskell-specific code. You'll probably have to mess around with the layout, but the two widgets (text and image) should still be the same and so act the same from the perspective of reactive-banana. On Tue, Jan 6, 2015 at 5:06 PM, Jeffrey Brown wrote: > Hi! > > I want to write a mindmapping app, like Freeplane, which involves drawing > rectangles containing text and arrows connecting them. For that purpose, > today I installed reactive-banana, wxWidgets, wxHaskell and > reactive-banana-wx. (It's the first complex install for which I didn't have > to write the list for help!) > > Am I correct that the question of whether graphics can be superimposed > over text depends only on wxHaskell, and not reactive-banana? Would you > recommend first writing code that uses only wxHaskell, to become familiar > with the library, or jumping right in by using reactive-banana at the same > time? > > Regards, > Jeff > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From anton.dessiatov at gmail.com Wed Jan 7 07:53:37 2015 From: anton.dessiatov at gmail.com (Anton Dessiatov) Date: Wed, 7 Jan 2015 13:53:37 +0600 Subject: [Haskell-cafe] GHC 7.8.4 for Windows x86 Message-ID: <1D81815575964AA49735A654EDA57D9A@futurama.local> Hello, Haskell Caf?! Does anybody know what?s the reason for the lack of GHC 7.8.4 windows x86 build? I could only find x64 version on the official website and it seems like minghc project doesn?t offer x86 build too. Best regards, Anton. -------------- next part -------------- An HTML attachment was scrubbed... URL: From stephen.tetley at gmail.com Wed Jan 7 08:09:38 2015 From: stephen.tetley at gmail.com (Stephen Tetley) Date: Wed, 7 Jan 2015 08:09:38 +0000 Subject: [Haskell-cafe] Study GUI and FRP sequentially or concurrently? Superimposing graphics and text. In-Reply-To: References: Message-ID: Hi Jeffrey You might want to take a serious look at Blobs: https://hackage.haskell.org/package/Blobs-0.3/src/ Almost certainly it will have bit-rotted, but when it was active it would definitely have been the best starting point for a "boxes and arrows" editor. Best wishes Stephen On 7 January 2015 at 01:06, Jeffrey Brown wrote: > Hi! > > I want to write a mindmapping app, like Freeplane, which involves drawing > rectangles containing text and arrows connecting them. For that purpose, > today I installed reactive-banana, wxWidgets, wxHaskell and > reactive-banana-wx. (It's the first complex install for which I didn't have > to write the list for help!) > > Am I correct that the question of whether graphics can be superimposed over > text depends only on wxHaskell, and not reactive-banana? Would you recommend > first writing code that uses only wxHaskell, to become familiar with the > library, or jumping right in by using reactive-banana at the same time? > > Regards, > Jeff > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From nicholls.mark at vimn.com Wed Jan 7 08:40:59 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Wed, 7 Jan 2015 08:40:59 +0000 Subject: [Haskell-cafe] typeclass woes...how to constain a typeclass to be "closed" under an operation.... In-Reply-To: <0d5d93ad-0196-4c03-9eb1-30f0106939e3@googlegroups.com> References: <20150106180936.GJ30046@weber> ,> ,> <84490E6E-23EE-46A3-B1E3-82AC9EED9DD5@vimn.com> , <0d5d93ad-0196-4c03-9eb1-30f0106939e3@googlegroups.com> Message-ID: <66ED3BE6-97BC-4E62-8DA2-EEDFB9E7E40E@vimn.com> (Caveat) In haskell specifically, i cant say, i rarely use it, and not in anger, im trying to pick it up again. Set closure under an operation is common, and in maths is axiomatic to many theories eg group theory, in fact at some level its probably axiomatic to all maths eg model theory Many useful operations are trivially closed eg arithmetic. Operatosn that are closed to the domain of the operation can be generalised to N applications, eg because + on integer is closed i can apply it N times and derive * if it werent then 6*5 may be defined but 6*6 may not be! (Undefined throws a spanner in the works, but i'll ignore it) I think in programming you rarely explicitly think about it, but you use it (arguably) everywhere Closure under the typeclass instance type of kind *->* (i expect thats not the right way to say it) seems common in haskell, monoid, monad, num etc...... I wanted to see if there was a way to do it using type families over types of kind *, as in some ways this seems less onerous on the user of the class and more prescriptive.....ie fill in this type family def, write the operation definitoon and your done Excuse the spelling, sent from a phone with itty bitty keys, it like trying to sow a button on a shirt with a sausage. On 7 Jan 2015, at 07:24, Dmin > wrote: hi, i'm sorry to interject but this post caught my attention. i understand how both classes help constrain the type ops >> class Foo_ (S a) => Foo a where >> type S a >> op :: a -> (S a) but what is really on my mind is for what purpose do you want to understand "closing" a type signature in a class. As a beginner myself I would venture to say this is common in haskell, no? Is this a good analogy to the set-theory paradigm? Which I believe was the original question, right? On Tuesday, January 6, 2015 11:18:29 AM UTC-8, Nicholls, Mark wrote: In fact i had tried somethjng very much like this but without the Foo_ and haskell wasnt happy with the cyclic definition So maybe this is the answer! I'll let you know Excuse the spelling, sent from a phone with itty bitty keys, it like trying to sow a button on a shirt with a sausage. > On 6 Jan 2015, at 19:14, Nicholls, Mark > wrote: > > Oooo > > I'll have a go with this tomorrow > > Thanks > > Excuse the spelling, sent from a phone with itty bitty keys, it like trying to sow a button on a shirt with a sausage. > > >> On 6 Jan 2015, at 19:06, adam vogt > wrote: >> >> Hi, >> >> You can constrain the result type to be in the same class by writing >> something like: >> >> {-# LANGUAGE UndecidableInstances, FlexibleInstances #-} >> {-# LANGUAGE TypeFamilies, FlexibleContexts #-} >> >> class Foo_ a -- just to prevent a cycle in superclass constraints >> instance Foo a => Foo_ a >> >> class Foo_ (S a) => Foo a where >> type S a >> op :: a -> (S a) >> >> -- and an example where you get a compile error if "op x" has an instance, >> -- but "op (op x)" does not have an instance. >> instance Foo Int where >> type S Int = Char >> op = toEnum >> >> instance Foo Char where >> type S Char = (Char,Char) >> op x = (x,x) >> >> instance Foo (Char,Char) where >> type S (Char,Char) = Int >> op (x,y) = fromEnum x >> >> >>> On Tue, Jan 6, 2015 at 1:53 PM, Nicholls, Mark > wrote: >>> I will post the question again properly tomorrow but your example indeed is almost a good example, but is trivially closed >>> >>> If the operation on monoid was >>> >>> [a]->[b]->[c] >>> >>> That is also closed; ie [c] is also a monoid.... And the typeclass declaration follows the idiom ive suggested >>> >>> This only works for types of kind *->* >>> >>> If i wanted to do this over a type of kind * (ignoring the trivial a->a) >>> >>> Can i express this in a typeclass? >>> >>> Please ignore until i resubmit this question >>> >>> Ps i hate phones >>> >>> Excuse the spelling, sent from a phone with itty bitty keys, it like trying to sow a button on a shirt with a sausage. >>> >>> >>>>> On 6 Jan 2015, at 18:10, Tom Ellis > wrote: >>>>> >>>>> On Tue, Jan 06, 2015 at 05:43:47PM +0000, Nicholls, Mark wrote: >>>>> Its quite common in maths to have operations in a theory that are (set) >>>>> closed, i just want to translate that notion to a typeclass >>>> >>>> Do you really need a typeclass (or indeed any way) of doing this? I suspect >>>> it will not work. If you consider the multiplication for the monoid of >>>> concatenation of lists >>>> >>>> (++) :: [a] -> [a] -> [a] >>>> >>>> you see that its type already implies that it is "closed". >>>> >>>> Tom >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskel... at haskell.org >>>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>> CONFIDENTIALITY NOTICE >>> >>> This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. >>> >>> While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. >>> >>> Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. >>> >>> MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskel... at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskel... at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. _______________________________________________ Haskell-Cafe mailing list Haskel... at haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ollie at ocharles.org.uk Wed Jan 7 10:32:46 2015 From: ollie at ocharles.org.uk (Oliver Charles) Date: Wed, 07 Jan 2015 10:32:46 +0000 Subject: [Haskell-cafe] Study GUI and FRP sequentially or concurrently? Superimposing graphics and text. In-Reply-To: References: Message-ID: <87ppaqop81.fsf@fynder-widget.localhost> Jeffrey Brown writes: > Hi! > > I want to write a mindmapping app, like Freeplane, which involves drawing > rectangles containing text and arrows connecting them. For that purpose, > today I installed reactive-banana, wxWidgets, wxHaskell and > reactive-banana-wx. (It's the first complex install for which I didn't have > to write the list for help!) > > Am I correct that the question of whether graphics can be superimposed over > text depends only on wxHaskell, and not reactive-banana? Would you > recommend first writing code that uses only wxHaskell, to become familiar > with the library, or jumping right in by using reactive-banana at the same > time? Hi Jeffrey, You might be interested in the work I'm doing on a 2D level editor for a game I'm building. The game is "hadoom", and it's a clone of Doom (inventive name, eh?). The level editor is top-down cartography software, and you can see fairly recent screenshots here: http://t.co/LgMRHw2y0Z http://t.co/O2DhKZWwcG There is also an old video here https://www.youtube.com/watch?v=Cfc4QkfAHx4 Anyway, the reason I say this might be interesting, is this is built using reactive-banana, GTK, and the "diagrams" library. I've found this a really nice way of building an interactive GUI such as this - GTK gives me the basic framework of the application, and I use a GtkDrawingArea for the main canvas. I then model all interaction through reactive-banana, and finally output a Diagram at the end. I use the diagrams-cairo backend to render this directly into the GtkDrawingArea. The source code for this is at https://github.com/ocharles/hadoom/tree/master/hadoom-editor though I should warn you it's somewhat in a state of rapid development, so things may change wildly. However, the basic approach of using GTK, reactive-banana & diagrams will not change. Hope this helps! -- ocharles -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 472 bytes Desc: not available URL: From han.joosten.han at gmail.com Wed Jan 7 12:42:07 2015 From: han.joosten.han at gmail.com (Han Joosten) Date: Wed, 7 Jan 2015 04:42:07 -0800 (PST) Subject: [Haskell-cafe] windows crashes (bsod) during link phase Message-ID: <2c6fb232-1288-4068-b309-9094db6d4bb6@googlegroups.com> Hi, When I build ampersand (sources from https://github.com/AmpersandTarski/ampersand ) everything compiles correctly. However, during link time, windows crashes and I get a blue screen of death. A colleque of mine has exactly the same experience. However, when I do this on another windows 7 machine, I get a working executable. I would say that any program that compiles correctly cannot cause the linker to fail. I am not very familiar with the build system, but this is a serious blocking issue for me working on that project. Any help is very much appreciated. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From apfelmus at quantentunnel.de Wed Jan 7 14:52:01 2015 From: apfelmus at quantentunnel.de (Heinrich Apfelmus) Date: Wed, 07 Jan 2015 15:52:01 +0100 Subject: [Haskell-cafe] threepenny-gui: garbage collection In-Reply-To: <20150105173708.GD27654@weber> References: <20150103005739.GA21812@weber> <20150103114418.GA23099@weber> <20150105173708.GD27654@weber> Message-ID: Tom Ellis wrote: > On Mon, Jan 05, 2015 at 06:31:57PM +0100, Heinrich Apfelmus wrote: >> Tom Ellis wrote: >>> Heinrich Apfelmus wrote: >>>> Tom Ellis wrote: >>>>> Suppose that each time I make a particular threepenny-gui widget, call it a >>>>> `Foo`, I register an event handler using `on` so that the `Foo` can change >>>>> its appearance based on some `Event`. >>>>> >>>>> Suppose I create, show, and hide a billion `Foo`s, each one never to be >>>>> shown again. Can they be garbage collected? Presumably there is something >>>>> storing the callback that was registered for the `Event` and the callback >>>>> refers to the `Foo`. How then can the `Foo`s be freed? >>>>> >>>>> [..] >>>> This is a classic example of a circular reference that occurs in >>>> every GUI program: A widget keeps a reference to an event handler, >>>> which in turn keeps a reference to the widget. >>> Hi Heinrich, thanks for your reply. >>> >>> Actually I don't think I am thinking of a circular reference problem. The >>> problem I am envisaging is that the `Event` keeps a reference to the event >>> handler which in turn keeps a reference to the widget. Thus it is hard to >>> see how the widget can be freed before the `Event`. A quick Google shows >>> this indeed a common problem in GUI programming, e.g. >>> >>> http://stackoverflow.com/questions/4526829/why-and-how-to-avoid-event-handler-memory-leaks >> Consider this: Who keeps a reference to the `Event`? >> >> (If no one keeps a reference to the `Event`, then it can be garbage >> collected, and so can the event handler and the widget.) > > I am suggesting that the `Event` originates elsewhere, perhaps from some > other widget that we wish to have a long life, but we want to attach > short-lived widgets to it via event handlers. Can we do that without having > to explicitly unregister the handlers when we want the short-lived widgets > to be garbage collected? Well, of course then you have to unregister the event handlers, otherwise they will reference the widget. If you don't unregister them, then they will, in fact, be long-lived by definition, because the widget could still react to the event. Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com From rasen.dubi at gmail.com Wed Jan 7 16:56:42 2015 From: rasen.dubi at gmail.com (Alexey Shmalko) Date: Wed, 7 Jan 2015 18:56:42 +0200 Subject: [Haskell-cafe] typeclass woes...how to constain a typeclass to be "closed" under an operation.... In-Reply-To: <66ED3BE6-97BC-4E62-8DA2-EEDFB9E7E40E@vimn.com> References: <20150106180936.GJ30046@weber> <84490E6E-23EE-46A3-B1E3-82AC9EED9DD5@vimn.com> <0d5d93ad-0196-4c03-9eb1-30f0106939e3@googlegroups.com> <66ED3BE6-97BC-4E62-8DA2-EEDFB9E7E40E@vimn.com> Message-ID: Hi, While I agree that Monad is closed (under >>= and >>) and is of kind * -> *, I can't say the same for Num or Monoid. Both of them are of kind *. So, you just named a few closed classes of kind *. Is that what you want? Why do you need type families for that? Isn't type class enough? (The following seems to be random thoughts on generality of closure constraint. It would be great if someone thinks the same way or can change my mind) I believe typeclasses is not the best way to express closure. For me, closure is mostly a property of operation than set itself. i.e. it's better to express it in operation type than There are a couple of issues preventing successful generalization of closure: First one is that you can have closing unary, binary, ternary etc operation. You could actually create a typeclass for each arity of operator but that's kind of silly; you can't create classes for every arity out there. Second issue is set. For Monad I can think of two ways for defining a closed set: it's either all Monads of that kind (then Monad is closed under >>=) or all values of m a type (Maybe Int, for example). In the later case you can define a stricter version of >>= (m a -> (a -> m a) -> m a) to close it. More real-world example of the second case is MonadPlus. While it's of kind * -> *, it's closed on mplus with mplus :: m a -> m a -> m a. (Probably, it's not MonadPlus is closed, but MonadPlus m => m a is closed under mplus). The last issue is absence of rules. Most mathematical concepts have some rules. The rules is what makes them worth generalizing. For example, Semigroup has a single rule (associativity of operation), but without that rule Semigroup is worthless (BTW, it would be just a type closed under .++.) . Closure, on the other hand, is just a constraint. Absence of rules also makes it possible to close the same type in many-many ways. For example, Num is closed under nine operations from Prelude module only. I believe, it's too general concept to express in typeclass and benefit from that. Regards, Alexey 2015-01-07 10:40 GMT+02:00 Nicholls, Mark : > (Caveat) In haskell specifically, i cant say, i rarely use it, and not in > anger, im trying to pick it up again. > > Set closure under an operation is common, and in maths is axiomatic to many > theories eg group theory, in fact at some level its probably axiomatic to > all maths eg model theory > > Many useful operations are trivially closed eg arithmetic. > > Operatosn that are closed to the domain of the operation can be generalised > to N applications, eg because + on integer is closed i can apply it N times > and derive * if it werent then 6*5 may be defined but 6*6 may not be! > (Undefined throws a spanner in the works, but i'll ignore it) > > I think in programming you rarely explicitly think about it, but you use it > (arguably) everywhere > > Closure under the typeclass instance type of kind *->* (i expect thats not > the right way to say it) seems common in haskell, monoid, monad, num > etc...... I wanted to see if there was a way to do it using type families > over types of kind *, as in some ways this seems less onerous on the user of > the class and more prescriptive.....ie fill in this type family def, write > the operation definitoon and your done > > > Excuse the spelling, sent from a phone with itty bitty keys, it like trying > to sow a button on a shirt with a sausage. > > > On 7 Jan 2015, at 07:24, Dmin wrote: > > hi, i'm sorry to interject but this post caught my attention. > > i understand how both classes help constrain the type ops > >>> class Foo_ (S a) => Foo a where >>> type S a >>> op :: a -> (S a) > > but what is really on my mind is for what purpose do you want to understand > "closing" a type signature in a class. As a beginner myself I would venture > to say this is common in haskell, no? Is this a good analogy to the > set-theory paradigm? Which I believe was the original question, right? > > > > On Tuesday, January 6, 2015 11:18:29 AM UTC-8, Nicholls, Mark wrote: >> >> In fact i had tried somethjng very much like this but without the Foo_ and >> haskell wasnt happy with the cyclic definition >> >> So maybe this is the answer! >> >> I'll let you know >> >> Excuse the spelling, sent from a phone with itty bitty keys, it like >> trying to sow a button on a shirt with a sausage. >> >> >> > On 6 Jan 2015, at 19:14, Nicholls, Mark wrote: >> > >> > Oooo >> > >> > I'll have a go with this tomorrow >> > >> > Thanks >> > >> > Excuse the spelling, sent from a phone with itty bitty keys, it like >> > trying to sow a button on a shirt with a sausage. >> > >> > >> >> On 6 Jan 2015, at 19:06, adam vogt wrote: >> >> >> >> Hi, >> >> >> >> You can constrain the result type to be in the same class by writing >> >> something like: >> >> >> >> {-# LANGUAGE UndecidableInstances, FlexibleInstances #-} >> >> {-# LANGUAGE TypeFamilies, FlexibleContexts #-} >> >> >> >> class Foo_ a -- just to prevent a cycle in superclass constraints >> >> instance Foo a => Foo_ a >> >> >> >> class Foo_ (S a) => Foo a where >> >> type S a >> >> op :: a -> (S a) >> >> >> >> -- and an example where you get a compile error if "op x" has an >> >> instance, >> >> -- but "op (op x)" does not have an instance. >> >> instance Foo Int where >> >> type S Int = Char >> >> op = toEnum >> >> >> >> instance Foo Char where >> >> type S Char = (Char,Char) >> >> op x = (x,x) >> >> >> >> instance Foo (Char,Char) where >> >> type S (Char,Char) = Int >> >> op (x,y) = fromEnum x >> >> >> >> >> >>> On Tue, Jan 6, 2015 at 1:53 PM, Nicholls, Mark >> >>> wrote: >> >>> I will post the question again properly tomorrow but your example >> >>> indeed is almost a good example, but is trivially closed >> >>> >> >>> If the operation on monoid was >> >>> >> >>> [a]->[b]->[c] >> >>> >> >>> That is also closed; ie [c] is also a monoid.... And the typeclass >> >>> declaration follows the idiom ive suggested >> >>> >> >>> This only works for types of kind *->* >> >>> >> >>> If i wanted to do this over a type of kind * (ignoring the trivial >> >>> a->a) >> >>> >> >>> Can i express this in a typeclass? >> >>> >> >>> Please ignore until i resubmit this question >> >>> >> >>> Ps i hate phones >> >>> >> >>> Excuse the spelling, sent from a phone with itty bitty keys, it like >> >>> trying to sow a button on a shirt with a sausage. >> >>> >> >>> >> >>>>> On 6 Jan 2015, at 18:10, Tom Ellis >> >>>>> wrote: >> >>>>> >> >>>>> On Tue, Jan 06, 2015 at 05:43:47PM +0000, Nicholls, Mark wrote: >> >>>>> Its quite common in maths to have operations in a theory that are >> >>>>> (set) >> >>>>> closed, i just want to translate that notion to a typeclass >> >>>> >> >>>> Do you really need a typeclass (or indeed any way) of doing this? I >> >>>> suspect >> >>>> it will not work. If you consider the multiplication for the monoid >> >>>> of >> >>>> concatenation of lists >> >>>> >> >>>> (++) :: [a] -> [a] -> [a] >> >>>> >> >>>> you see that its type already implies that it is "closed". >> >>>> >> >>>> Tom >> >>>> _______________________________________________ >> >>>> Haskell-Cafe mailing list >> >>>> Haskel... at haskell.org >> >>>> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >>> CONFIDENTIALITY NOTICE >> >>> >> >>> This e-mail (and any attached files) is confidential and protected by >> >>> copyright (and other intellectual property rights). If you are not the >> >>> intended recipient please e-mail the sender and then delete the email and >> >>> any attached files immediately. Any further use or dissemination is >> >>> prohibited. >> >>> >> >>> While MTV Networks Europe has taken steps to ensure that this email >> >>> and any attachments are virus free, it is your responsibility to ensure that >> >>> this message and any attachments are virus free and do not affect your >> >>> systems / data. >> >>> >> >>> Communicating by email is not 100% secure and carries risks such as >> >>> delay, data corruption, non-delivery, wrongful interception and unauthorised >> >>> amendment. If you communicate with us by e-mail, you acknowledge and assume >> >>> these risks, and you agree to take appropriate measures to minimise these >> >>> risks when e-mailing us. >> >>> >> >>> MTV Networks International, MTV Networks UK & Ireland, Greenhouse, >> >>> Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions >> >>> International, Be Viacom, Viacom International Media Networks and VIMN and >> >>> Comedy Central are all trading names of MTV Networks Europe. MTV Networks >> >>> Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks >> >>> Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, >> >>> London, NW1 8TT. >> >>> >> >>> _______________________________________________ >> >>> Haskell-Cafe mailing list >> >>> Haskel... at haskell.org >> >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> _______________________________________________ >> >> Haskell-Cafe mailing list >> >> Haskel... at haskell.org >> >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> CONFIDENTIALITY NOTICE >> >> This e-mail (and any attached files) is confidential and protected by >> copyright (and other intellectual property rights). If you are not the >> intended recipient please e-mail the sender and then delete the email and >> any attached files immediately. Any further use or dissemination is >> prohibited. >> >> While MTV Networks Europe has taken steps to ensure that this email and >> any attachments are virus free, it is your responsibility to ensure that >> this message and any attachments are virus free and do not affect your >> systems / data. >> >> Communicating by email is not 100% secure and carries risks such as delay, >> data corruption, non-delivery, wrongful interception and unauthorised >> amendment. If you communicate with us by e-mail, you acknowledge and assume >> these risks, and you agree to take appropriate measures to minimise these >> risks when e-mailing us. >> >> MTV Networks International, MTV Networks UK & Ireland, Greenhouse, >> Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions >> International, Be Viacom, Viacom International Media Networks and VIMN and >> Comedy Central are all trading names of MTV Networks Europe. MTV Networks >> Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks >> Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, >> London, NW1 8TT. >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskel... at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > CONFIDENTIALITY NOTICE > > This e-mail (and any attached files) is confidential and protected by > copyright (and other intellectual property rights). If you are not the > intended recipient please e-mail the sender and then delete the email and > any attached files immediately. Any further use or dissemination is > prohibited. > > While MTV Networks Europe has taken steps to ensure that this email and any > attachments are virus free, it is your responsibility to ensure that this > message and any attachments are virus free and do not affect your systems / > data. > > Communicating by email is not 100% secure and carries risks such as delay, > data corruption, non-delivery, wrongful interception and unauthorised > amendment. If you communicate with us by e-mail, you acknowledge and assume > these risks, and you agree to take appropriate measures to minimise these > risks when e-mailing us. > > MTV Networks International, MTV Networks UK & Ireland, Greenhouse, > Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions > International, Be Viacom, Viacom International Media Networks and VIMN and > Comedy Central are all trading names of MTV Networks Europe. MTV Networks > Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks > Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, > London, NW1 8TT. > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From jeffbrown.the at gmail.com Wed Jan 7 17:01:18 2015 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Wed, 7 Jan 2015 09:01:18 -0800 Subject: [Haskell-cafe] Study GUI and FRP sequentially or concurrently? Superimposing graphics and text. In-Reply-To: <87ppaqop81.fsf@fynder-widget.localhost> References: <87ppaqop81.fsf@fynder-widget.localhost> Message-ID: Reactive-banana can work with GTK?! Heinrich, Oliver, should perhaps the bindings at https://github.com/ocharles/hadoom/blob/master/hadoom-editor/Reactive/Banana/GTK.hs be referred to from the reactive banana homepage? On Wed, Jan 7, 2015 at 2:32 AM, Oliver Charles wrote: > Jeffrey Brown writes: > > > Hi! > > > > I want to write a mindmapping app, like Freeplane, which involves drawing > > rectangles containing text and arrows connecting them. For that purpose, > > today I installed reactive-banana, wxWidgets, wxHaskell and > > reactive-banana-wx. (It's the first complex install for which I didn't > have > > to write the list for help!) > > > > Am I correct that the question of whether graphics can be superimposed > over > > text depends only on wxHaskell, and not reactive-banana? Would you > > recommend first writing code that uses only wxHaskell, to become familiar > > with the library, or jumping right in by using reactive-banana at the > same > > time? > > Hi Jeffrey, > > You might be interested in the work I'm doing on a 2D level editor for a > game I'm building. The game is "hadoom", and it's a clone of Doom > (inventive name, eh?). The level editor is top-down cartography > software, and you can see fairly recent screenshots here: > > http://t.co/LgMRHw2y0Z > http://t.co/O2DhKZWwcG > > There is also an old video here > > https://www.youtube.com/watch?v=Cfc4QkfAHx4 > > Anyway, the reason I say this might be interesting, is this is built > using reactive-banana, GTK, and the "diagrams" library. I've found this > a really nice way of building an interactive GUI such as this - GTK > gives me the basic framework of the application, and I use a > GtkDrawingArea for the main canvas. I then model all interaction through > reactive-banana, and finally output a Diagram at the end. I use the > diagrams-cairo backend to render this directly into the GtkDrawingArea. > > The source code for this is at > > https://github.com/ocharles/hadoom/tree/master/hadoom-editor > > though I should warn you it's somewhat in a state of rapid development, > so things may change wildly. However, the basic approach of using GTK, > reactive-banana & diagrams will not change. > > Hope this helps! > > -- ocharles > -------------- next part -------------- An HTML attachment was scrubbed... URL: From apfelmus at quantentunnel.de Wed Jan 7 17:20:11 2015 From: apfelmus at quantentunnel.de (Heinrich Apfelmus) Date: Wed, 07 Jan 2015 18:20:11 +0100 Subject: [Haskell-cafe] Study GUI and FRP sequentially or concurrently? Superimposing graphics and text. In-Reply-To: References: <87ppaqop81.fsf@fynder-widget.localhost> Message-ID: Jeffrey Brown wrote: > Reactive-banana can work with GTK?! Heinrich, Oliver, should perhaps the > bindings at > https://github.com/ocharles/hadoom/blob/master/hadoom-editor/Reactive/Banana/GTK.hs > be referred to from the reactive banana homepage? Feel free to add a link to the project homepage on the Haskell wiki. Actually, there are several people who have made small bindings to GTK. Unfortunately, I can't bless any of them, because I never managed to install GTK correctly on MacOS X, which means that I can't test them. See also: https://github.com/HeinrichApfelmus/reactive-banana/pull/71#issuecomment-67780937 Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com From ollie at ocharles.org.uk Wed Jan 7 18:33:07 2015 From: ollie at ocharles.org.uk (Oliver Charles) Date: Wed, 07 Jan 2015 18:33:07 +0000 Subject: [Haskell-cafe] Study GUI and FRP sequentially or concurrently? Superimposing graphics and text. In-Reply-To: References: <87ppaqop81.fsf@fynder-widget.localhost> Message-ID: <87fvbmmof0.fsf@fynder-widget.localhost> Jeffrey Brown writes: > Reactive-banana can work with GTK?! Heinrich, Oliver, should perhaps the > bindings at > https://github.com/ocharles/hadoom/blob/master/hadoom-editor/Reactive/Banana/GTK.hs > be referred to from the reactive banana homepage? Well... as an example, sure. But they are hardly something that I'd expect to package up as a library. I haven't given them a huge amount of thought, and as you can see - they are just appearing as I need them. My project doesn't really interact with GTK a great deal, it just uses it to create a window and display some basic properties. The beauty of reactive-banana is that it's really just a very declarative way of dealing with IO callbacks. So it can support GTK, WxWidgets, QT (if we had bindings), and even GUI frameworks that don't even exist! :) -- ocharles -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 472 bytes Desc: not available URL: From michael at orlitzky.com Thu Jan 8 03:40:54 2015 From: michael at orlitzky.com (Michael Orlitzky) Date: Wed, 07 Jan 2015 22:40:54 -0500 Subject: [Haskell-cafe] hxt: How to Unpickle Multiple Adjacent Elements In-Reply-To: <874ms69lyn.fsf@kudu.i-did-not-set--mail-host-address--so-tickle-me> References: <874ms69lyn.fsf@kudu.i-did-not-set--mail-host-address--so-tickle-me> Message-ID: <54ADFC46.9040406@orlitzky.com> On 01/04/2015 06:15 PM, Jimmy Lu wrote: > Hi, > > With xml element having DTD like following: > > > > I want to unpickle the sequence > > hw, hsl?, (pr | altpr)?, (ahw, hsl?, (pr | altpr)?)* > > into Haskell data type [Headword] where Are you asking how to extract ONLY that sequence? If so, it's not possible: you have to provide a pickler/unpickler for the whole thing, and then ignore the parts you don't want. That aside, you might not want to make a list out of the elements you've shown. That's a sequence of a fixed number of heterogeneous things. The first one is an "hw", the second is an "(optional) hsl", the third is an "(optional) pr or altpr",... The last expression with the star is what you'd want to (un)pickle into a list. From dstcruz at gmail.com Thu Jan 8 04:24:54 2015 From: dstcruz at gmail.com (Daniel Santa Cruz) Date: Wed, 7 Jan 2015 21:24:54 -0700 Subject: [Haskell-cafe] Haskell Weekly News: Issue 314 Message-ID: Welcome to issue 314 of the HWN, an issue covering crowd-sourced bits of information about Haskell from around the web. This issue covers from December 7, 2014 to January 3, 2015 I know... I know. It's been a while Quotes of the Week * arianvp__: after 5 hours of hacking my code works || now its 3 am || Types make a lot more sense when I'm tired for some reason * dmwit: "Any coder worth his salt can do the impossible." * hodapp: Math is too hard. Let's use JavaScript. * Zemyla: I imagine if [Edward Kmett] had found C++, he would be writing template definitions that would make the faces of the Boost team melt off. Top Reddit Stories * Kronos Haskell Notebook (Mac App) Domain: kronosnotebook.com, Score: 114, Comments: 21 Original: [1] http://goo.gl/nOnLuz On Reddit: [2] http://goo.gl/SNLxjo * The "What Are Monads?" Fallacy Domain: two-wrongs.com, Score: 112, Comments: 93 Original: [3] http://goo.gl/Beu6wO On Reddit: [4] http://goo.gl/CxcK1f * Learn You Some Algebras for Glorious Good! - A fun, easy-to-read math textbook. Domain: self.haskell, Score: 109, Comments: 106 Original: [5] http://goo.gl/3623n6 On Reddit: [6] http://goo.gl/3623n6 * GHC illustrated [PDF] Domain: takenobu-hs.github.io, Score: 108, Comments: 30 Original: [7] http://goo.gl/yj7ySL On Reddit: [8] http://goo.gl/sro7qH * The Haskell Cast #9 - Conal Elliott on FRP and Denotational Design Domain: haskellcast.com, Score: 94, Comments: 34 Original: [9] http://goo.gl/tls8K3 On Reddit: [10] http://goo.gl/NIJZ1X * GHC 7.10.1 will support 'static values', allowing you to create stable references to values across programs/machines for serialization, RPC, etc... Domain: phabricator.haskell.org, Score: 91, Comments: 26 Original: [11] http://goo.gl/bsfROl On Reddit: [12] http://goo.gl/weGkIq * 24 Days of GHC Extensions: Thanks! Domain: ocharles.org.uk, Score: 82, Comments: 11 Original: [13] http://goo.gl/6ee2Jb On Reddit: [14] http://goo.gl/CYoai5 * git clone in Haskell from the bottom up Domain: stefan.saasen.me, Score: 81, Comments: 9 Original: [15] http://goo.gl/nWSXV On Reddit: [16] http://goo.gl/ULS3YO * A commentary on 24 days of GHC extensions Domain: augustss.blogspot.com, Score: 78, Comments: 5 Original: [17] http://goo.gl/C4nKNN On Reddit: [18] http://goo.gl/cGBdss * Haskell for all: A very general API for relational joins Domain: haskellforall.com, Score: 77, Comments: 29 Original: [19] http://goo.gl/WVGtQl On Reddit: [20] http://goo.gl/8McEkB * Elm 0.14 - Simpler Core, Better Tools Domain: elm-lang.org, Score: 76, Comments: 38 Original: [21] http://goo.gl/7Oq4Xe On Reddit: [22] http://goo.gl/e9wbAm * Rethinking webservice and APIs in Haskell: servant 0.2 Domain: alpmestan.com, Score: 74, Comments: 59 Original: [23] http://goo.gl/Jl2CMS On Reddit: [24] http://goo.gl/HsB5zi * ANNOUNCE: GHC 7.10.1 Release Candidate 1 Domain: permalink.gmane.org, Score: 74, Comments: 4 Original: [25] http://goo.gl/I9ezar On Reddit: [26] http://goo.gl/SRNHG9 * 24 Days of GHC Extensions: Rank N Types Domain: ocharles.org.uk, Score: 69, Comments: 27 Original: [27] http://goo.gl/1OuyNg On Reddit: [28] http://goo.gl/5m79zT * A Haskell Implementation Reading List Domain: stephendiehl.com, Score: 66, Comments: 0 Original: [29] http://goo.gl/YnFyTs On Reddit: [30] http://goo.gl/3TudIF * Learning Curves for different programming languages (including Haskell) Domain: github.com, Score: 66, Comments: 106 Original: [31] http://goo.gl/SxsT10 On Reddit: [32] http://goo.gl/KNsLqh * Functional Education Domain: bitemyapp.com, Score: 66, Comments: 10 Original: [33] http://goo.gl/f4EI02 On Reddit: [34] http://goo.gl/wDxjkj * Snowdrift.coop hiring lead programmer (Haskell/Yesod) Domain: snowdrift.coop, Score: 65, Comments: 8 Original: [35] http://goo.gl/Nh0GL2 On Reddit: [36] http://goo.gl/8tLsy8 * 24 Days of GHC Extensions: Functional Dependencies Domain: ocharles.org.uk, Score: 58, Comments: 4 Original: [37] http://goo.gl/mBkf8n On Reddit: [38] http://goo.gl/uv3Mhs * So you want to learn type theory... but where to start? Here are some suggestions. Domain: purelytheoretical.com, Score: 58, Comments: 9 Original: [39] http://goo.gl/z73MMM On Reddit: [40] http://goo.gl/9AuJJl * 24 Days of Hackage: Static Pointers (guest post by Mathieu Boespflug) Domain: ocharles.org.uk, Score: 57, Comments: 32 Original: [41] http://goo.gl/4mhlNL On Reddit: [42] http://goo.gl/jsSYr9 * 24 Days of GHC Extensions: Type Families Domain: ocharles.org.uk, Score: 56, Comments: 11 Original: [43] http://goo.gl/uwLBsA On Reddit: [44] http://goo.gl/ykn06l * 24 Days of GHC Extensions: Nullary Type Classes Domain: ocharles.org.uk, Score: 54, Comments: 23 Original: [45] http://goo.gl/4k5bQw On Reddit: [46] http://goo.gl/crIJbb * 24 Days of GHC Extensions: DeriveGeneric Domain: ocharles.org.uk, Score: 54, Comments: 27 Original: [47] http://goo.gl/gKijr1 On Reddit: [48] http://goo.gl/SRMNuR * 24 Days of GHC Extensions: Existential Quantification (guest post by Roman Cheplyaka) Domain: ocharles.org.uk, Score: 54, Comments: 0 Original: [49] http://goo.gl/wXwsDU On Reddit: [50] http://goo.gl/vLaS92 * 24 Days of GHC Extensions: Multi-parameter Type Classes Domain: ocharles.org.uk, Score: 52, Comments: 11 Original: [51] http://goo.gl/2sWnsC On Reddit: [52] http://goo.gl/h4mRBb * A demo written in Haskell got 3rd place in Experience Domain: youtube.com, Score: 48, Comments: 37 Original: [53] http://goo.gl/9l7B6h On Reddit: [54] http://goo.gl/8Np97P * 24 Days of GHC Extensions: Overloaded Strings Domain: ocharles.org.uk, Score: 48, Comments: 23 Original: [55] http://goo.gl/u6aiAi On Reddit: [56] http://goo.gl/Xtww0S * Intro to Machines & Arrows (Part 1: Stream and Auto) Domain: blog.jle.im, Score: 48, Comments: 25 Original: [57] http://goo.gl/MwouKm On Reddit: [58] http://goo.gl/934frV * 24 Days of GHC Extensions: Recursive Do Domain: ocharles.org.uk, Score: 47, Comments: 7 Original: [59] http://goo.gl/iejmP8 On Reddit: [60] http://goo.gl/H8uEQS * 24 Days of GHC Extensions: Scoped Type Variables (guest post by Tim Docker) Domain: ocharles.org.uk, Score: 47, Comments: 18 Original: [61] http://goo.gl/sWS0dT On Reddit: [62] http://goo.gl/jFPZAC * ANNOUNCE: GHC version 7.8.4 Domain: permalink.gmane.org, Score: 47, Comments: 19 Original: [63] http://goo.gl/0ygVbv On Reddit: [64] http://goo.gl/2eWUsJ * Categories Great and Small (From Bartosz Milewski's Categories for Programmers series) Domain: bartoszmilewski.com, Score: 46, Comments: 8 Original: [65] http://goo.gl/NfpA7X On Reddit: [66] http://goo.gl/ghq472 * Denotational design does not work Domain: ro-che.info, Score: 45, Comments: 39 Original: [67] http://goo.gl/8hOm0A On Reddit: [68] http://goo.gl/tf4JVc Top StackOverflow Questions * What is happening when I compose * with + in Haskell? votes: 35, answers: 5 Read on SO: [69] http://goo.gl/S9h6Xi * Difference in performance of compiled accelerate code ran from ghci and shell votes: 22, answers: 0 Read on SO: [70] http://goo.gl/zxojbX * Why does this Haskell program diverge? votes: 20, answers: 1 Read on SO: [71] http://goo.gl/NDasIA * Is it possible to skip the nursery? votes: 20, answers: 1 Read on SO: [72] http://goo.gl/Qk4K5i * Haskell performance implementing unix's ?cat? program with Data.ByteString votes: 19, answers: 3 Read on SO: [73] http://goo.gl/ekoeor * showsPrec and operator precedences votes: 15, answers: 1 Read on SO: [74] http://goo.gl/ifxaUB * Why does let y = 1 + y compile, and what does it mean? votes: 15, answers: 1 Read on SO: [75] http://goo.gl/vp1Q02 * Type Family Shenanigans in GHCi votes: 13, answers: 1 Read on SO: [76] http://goo.gl/fvJzzO * Quirkiness in Haskell 7.8.3 votes: 13, answers: 1 Read on SO: [77] http://goo.gl/KprcEM * What is the difference between value constructors and tuples? votes: 11, answers: 2 Read on SO: [78] http://goo.gl/5ybmYY * Efficient version of 'inits' votes: 11, answers: 2 Read on SO: [79] http://goo.gl/Qwoirp * Working out the details of a type indexed free monad votes: 11, answers: 7 Read on SO: [80] http://goo.gl/oMjYQn * How to model a currencies, money, and banks that exchange money between currencies? votes: 10, answers: 3 Read on SO: [81] http://goo.gl/svZY2T * Why are these functions differently evaluated votes: 10, answers: 2 Read on SO: [82] http://goo.gl/nrD5pA * Why does a more general type affect runtime in Haskell? votes: 10, answers: 2 Read on SO: [83] http://goo.gl/oVeQKg * List based on right Kan extension votes: 9, answers: 2 Read on SO: [84] http://goo.gl/VxPhv0 * How to inject the result of an IO action into a non-IO monadic computation votes: 9, answers: 3 Read on SO: [85] http://goo.gl/WzrvDP * Why I get the ?class Num a where? instead of the ?class (Eq a, Show a) => Num a?? votes: 9, answers: 4 Read on SO: [86] http://goo.gl/glKEeK * How to avoid default return value when accessing a non-existent field with lenses? votes: 9, answers: 2 Read on SO: [87] http://goo.gl/RROrVM * How much does Haskell/GHC memoize? votes: 9, answers: 1 Read on SO: [88] http://goo.gl/PuUKt4 Until next time, [89]+Daniel Santa Cruz References 1. http://www.kronosnotebook.com/haskell 2. http://www.reddit.com/r/haskell/comments/2r43q0/kronos_haskell_notebook_mac_app/ 3. http://two-wrongs.com/the-what-are-monads-fallacy 4. http://www.reddit.com/r/haskell/comments/2r2cpe/the_what_are_monads_fallacy/ 5. http://www.reddit.com/r/haskell/comments/2qu7w8/learn_you_some_algebras_for_glorious_good_a_fun/ 6. http://www.reddit.com/r/haskell/comments/2qu7w8/learn_you_some_algebras_for_glorious_good_a_fun/ 7. http://takenobu-hs.github.io/downloads/haskell_ghc_illustrated.pdf 8. http://www.reddit.com/r/haskell/comments/2qxcmz/ghc_illustrated_pdf/ 9. http://www.haskellcast.com/episode/009-conal-elliott-on-frp-and-denotational-design/ 10. http://www.reddit.com/r/haskell/comments/2pdhe9/the_haskell_cast_9_conal_elliott_on_frp_and/ 11. https://phabricator.haskell.org/rGHCfc45f32491313d2a44e72d8d59cdf95b1660189d 12. http://www.reddit.com/r/haskell/comments/2otl0f/ghc_7101_will_support_static_values_allowing_you/ 13. https://ocharles.org.uk/blog/posts/2014-12-24-conclusion.html 14. http://www.reddit.com/r/haskell/comments/2qbfpe/24_days_of_ghc_extensions_thanks/ 15. http://stefan.saasen.me/articles/git-clone-in-haskell-from-the-bottom-up/ 16. http://www.reddit.com/r/haskell/comments/2okt2e/git_clone_in_haskell_from_the_bottom_up/ 17. http://augustss.blogspot.com/2014/12/a-commentary-on-24-days-of-ghc.html 18. http://www.reddit.com/r/haskell/comments/2pdu4a/a_commentary_on_24_days_of_ghc_extensions/ 19. http://www.haskellforall.com/2014/12/a-very-general-api-for-relational-joins.html 20. http://www.reddit.com/r/haskell/comments/2oji35/haskell_for_all_a_very_general_api_for_relational/ 21. http://elm-lang.org/blog/announce/0.14.elm 22. http://www.reddit.com/r/haskell/comments/2ovgw4/elm_014_simpler_core_better_tools/ 23. http://alpmestan.com/posts/2014-12-09-rethinking-webservices-apis-haskell.html 24. http://www.reddit.com/r/haskell/comments/2orb8t/rethinking_webservice_and_apis_in_haskell_servant/ 25. http://permalink.gmane.org/gmane.comp.lang.haskell.ghc.devel/7529 26. http://www.reddit.com/r/haskell/comments/2q6eei/announce_ghc_7101_release_candidate_1/ 27. https://ocharles.org.uk/blog/guest-posts/2014-12-18-rank-n-types.html 28. http://www.reddit.com/r/haskell/comments/2pqtxk/24_days_of_ghc_extensions_rank_n_types/ 29. http://www.stephendiehl.com/posts/essential_compilers.html 30. http://www.reddit.com/r/haskell/comments/2pbt0e/a_haskell_implementation_reading_list/ 31. https://github.com/Dobiasd/articles/blob/master/programming_language_learning_curves.md 32. http://www.reddit.com/r/haskell/comments/2qjnho/learning_curves_for_different_programming/ 33. http://bitemyapp.com/posts/2014-12-31-functional-education.html 34. http://www.reddit.com/r/haskell/comments/2r0q9h/functional_education/ 35. https://snowdrift.coop/p/snowdrift/w/en/jobs 36. http://www.reddit.com/r/haskell/comments/2r6nke/snowdriftcoop_hiring_lead_programmer_haskellyesod/ 37. https://ocharles.org.uk/blog/posts/2014-12-14-functional-dependencies.html 38. http://www.reddit.com/r/haskell/comments/2pal4v/24_days_of_ghc_extensions_functional_dependencies/ 39. http://purelytheoretical.com/sywtltt.html 40. http://www.reddit.com/r/haskell/comments/2pzczc/so_you_want_to_learn_type_theory_but_where_to/ 41. https://ocharles.org.uk/blog/guest-posts/2014-12-23-static-pointers.html 42. http://www.reddit.com/r/haskell/comments/2q85zp/24_days_of_hackage_static_pointers_guest_post_by/ 43. https://ocharles.org.uk/blog/posts/2014-12-12-type-families.html 44. http://www.reddit.com/r/haskell/comments/2p3mrm/24_days_of_ghc_extensions_type_families/ 45. https://ocharles.org.uk/blog/posts/2014-12-10-nullary-type-classes.html 46. http://www.reddit.com/r/haskell/comments/2ovvnk/24_days_of_ghc_extensions_nullary_type_classes/ 47. https://ocharles.org.uk/blog/posts/2014-12-16-derive-generic.html 48. http://www.reddit.com/r/haskell/comments/2pirdg/24_days_of_ghc_extensions_derivegeneric/ 49. https://ocharles.org.uk/blog/guest-posts/2014-12-19-existential-quantification.html 50. http://www.reddit.com/r/haskell/comments/2pu0e8/24_days_of_ghc_extensions_existential/ 51. https://ocharles.org.uk/blog/posts/2014-12-13-multi-param-type-classes.html 52. http://www.reddit.com/r/haskell/comments/2p792t/24_days_of_ghc_extensions_multiparameter_type/ 53. https://www.youtube.com/watch?v=-qISxjnikJ4 54. http://www.reddit.com/r/haskell/comments/2oqo33/a_demo_written_in_haskell_got_3rd_place_in/ 55. https://ocharles.org.uk/blog/posts/2014-12-17-overloaded-strings.html 56. http://www.reddit.com/r/haskell/comments/2pmon2/24_days_of_ghc_extensions_overloaded_strings/ 57. http://blog.jle.im/entry/intro-to-machines-arrows-part-1-stream-and 58. http://www.reddit.com/r/haskell/comments/2qirmb/intro_to_machines_arrows_part_1_stream_and_auto/ 59. https://ocharles.org.uk/blog/posts/2014-12-09-recursive-do.html 60. http://www.reddit.com/r/haskell/comments/2osh3v/24_days_of_ghc_extensions_recursive_do/ 61. https://ocharles.org.uk/blog/guest-posts/2014-12-20-scoped-type-variables.html 62. http://www.reddit.com/r/haskell/comments/2pwecw/24_days_of_ghc_extensions_scoped_type_variables/ 63. http://permalink.gmane.org/gmane.comp.lang.haskell.ghc.devel/7526 64. http://www.reddit.com/r/haskell/comments/2q6oln/announce_ghc_version_784/ 65. http://bartoszmilewski.com/2014/12/05/categories-great-and-small/ 66. http://www.reddit.com/r/haskell/comments/2phex1/categories_great_and_small_from_bartosz_milewskis/ 67. http://ro-che.info/articles/2014-12-31-denotational-design-does-not-work 68. http://www.reddit.com/r/haskell/comments/2qvbhp/denotational_design_does_not_work/ 69. http://stackoverflow.com/questions/27664213/what-is-happening-when-i-compose-with-in-haskell 70. http://stackoverflow.com/questions/27541609/difference-in-performance-of-compiled-accelerate-code-ran-from-ghci-and-shell 71. http://stackoverflow.com/questions/27421598/why-does-this-haskell-program-diverge 72. http://stackoverflow.com/questions/27630833/is-it-possible-to-skip-the-nursery 73. http://stackoverflow.com/questions/27463669/haskell-performance-implementing-unixs-cat-program-with-data-bytestring 74. http://stackoverflow.com/questions/27471937/showsprec-and-operator-precedences 75. http://stackoverflow.com/questions/27557380/why-does-let-y-1-y-compile-and-what-does-it-mean 76. http://stackoverflow.com/questions/27490352/type-family-shenanigans-in-ghci 77. http://stackoverflow.com/questions/27663435/quirkiness-in-haskell-7-8-3 78. http://stackoverflow.com/questions/27476446/what-is-the-difference-between-value-constructors-and-tuples 79. http://stackoverflow.com/questions/27672585/efficient-version-of-inits 80. http://stackoverflow.com/questions/27676294/working-out-the-details-of-a-type-indexed-free-monad 81. http://stackoverflow.com/questions/27408873/how-to-model-a-currencies-money-and-banks-that-exchange-money-between-currenci 82. http://stackoverflow.com/questions/27568791/why-are-these-functions-differently-evaluated 83. http://stackoverflow.com/questions/27683108/why-does-a-more-general-type-affect-runtime-in-haskell 84. http://stackoverflow.com/questions/27381133/list-based-on-right-kan-extension 85. http://stackoverflow.com/questions/27391293/how-to-inject-the-result-of-an-io-action-into-a-non-io-monadic-computation 86. http://stackoverflow.com/questions/27561604/why-i-get-the-class-num-a-where-instead-of-the-class-eq-a-show-a-num-a 87. http://stackoverflow.com/questions/27567664/how-to-avoid-default-return-value-when-accessing-a-non-existent-field-with-lense 88. http://stackoverflow.com/questions/27570371/how-much-does-haskell-ghc-memoize 89. https://plus.google.com/105107667630152149014/about -------------- next part -------------- An HTML attachment was scrubbed... URL: From info at rotnetix.com Thu Jan 8 08:07:19 2015 From: info at rotnetix.com (info at rotnetix.com) Date: Thu, 8 Jan 2015 00:07:19 -0800 (PST) Subject: [Haskell-cafe] Installing ihaskell on nixos Message-ID: <361d0f49-183c-480c-98f1-0663e52dbbf0@googlegroups.com> I am trying to set up ihaskell on EC2. I start with the NixOs EC2 instance (from http://nixos.org/nixos/download.html) and then basically install the ihaskell package using nix-env -i ihaskell. The installation runs fine but when I try to start the notebook with ihaskell notebook i get the following: Updating IPython profile. Loading profile from /nix/store/hlkvkavkgm3hj08ffdlziq30r7zyr060-haskell-ihaskell-ghc7.8.3-0.4.3.0-shared/share/x86_64-linux-ghc-7.8.3/ihaskell-0.4.3.0/profile/profile.tar IHaskell: Ran commands: mkdir -p /root/.ihaskell mkdir -p /root/.ihaskell/notebooks mkdir -p /root/.ihaskell /nix/store/hnmgn0jrpzlp5d91m5xawpr2iqsjxh7j-ipython-2.3.1/bin/ipython locate profile haskell which /nix/store/hnmgn0jrpzlp5d91m5xawpr2iqsjxh7j-ipython-2.3.1/bin/ipython /nix/store/hnmgn0jrpzlp5d91m5xawpr2iqsjxh7j-ipython-2.3.1/bin/ipython locate profile haskell which /nix/store/hnmgn0jrpzlp5d91m5xawpr2iqsjxh7j-ipython-2.3.1/bin/ipython Exception: /root/.ipython/profile_haskell/ipython_config.py: openFile: does not exist (No such file or directory) I poked around a bit and the root/.ipython/profile_haskell/ contains none of the expected profile files... Could not find anything by googling around except the suggestion to run the ihaskell setup command which seems to have been discontinued Can anyone suggest what I could try? Thanks Riaan -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicholls.mark at vimn.com Thu Jan 8 08:19:29 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Thu, 8 Jan 2015 08:19:29 +0000 Subject: [Haskell-cafe] typeclass woes...how to constain a typeclass to be "closed" under an operation.... In-Reply-To: <810019f9-dc50-4f87-89dd-7ee7c48beec9@googlegroups.com> References: , <810019f9-dc50-4f87-89dd-7ee7c48beec9@googlegroups.com> Message-ID: Reading around this more i think the extreme case (of what im interested in) is type arithemetic, ie the set of type "inside" the container is not necessarily finite in general, but yes, i see how you construct works. So in think for my specific purposes the associated type route is the first place for me to investigate Excuse the spelling, sent from a phone with itty bitty keys, it like trying to sow a button on a shirt with a sausage. On 7 Jan 2015, at 20:58, Akash Ganesan > wrote: If I understand the issue at hand, you want the container, which is basically a collection of types to be closed under our operation. Since we are dealing with set of different typed objects, which is to be closed under a given operation, why not create a new type that captures the essence of the set (ie., a new data type)? Something like the following. data S = SInt Int | SChar Char | STuple (Char, Char) deriving (Show, Eq) class MyFoo a where op :: a -> a And the instance goes something like this. instance MyFoo S where op (SInt x) = SInt $ toEnum x op (SChar x) = STuple (x,x) op (STuple (x,y)) = SInt $ fromEnum x On Tuesday, 6 January 2015 23:13:59 UTC+5:30, Nicholls, Mark wrote: This is reposted from the beginnners?.I?ve not done Haskell for a while and was struggling to get anything to work, I?ve hopefully refound my feet. Its quite common in maths to have operations in a theory that are (set) closed, i just want to translate that notion to a typeclass I have a suggestion that does work class Foo m where op :: m a -> m (S a) That is closed, but now were working on types of kind ? -> ? (S can be a type family or a data type?lets say it?s a type family?.probably an associated type (if I know what that means)) Is this the idiom/pattern i should follow? Or can the closure contraint be expressed directly in a typeclass any other way? From: Haskell-Cafe [mailto:haskell-ca... at haskell.org] On Behalf Of Brandon Allbery Sent: 06 January 2015 1:59 PM To: Rob Leslie Cc: Haskell Cafe Subject: Re: [Haskell-cafe] Haskeline and asynchronous messages On Tue, Jan 6, 2015 at 3:27 AM, Rob Leslie > wrote: Does anyone have a suggestion on using Haskeline in an environment where another thread may be writing messages to the terminal -- is it possible to somehow print incoming messages above the input line without disturbing the input line? Terminals don't really work that way; you need to be looking at something like curses or vty. -- brandon s allbery kf8nh sine nomine associates allb... at gmail.com ball... at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. -------------- next part -------------- An HTML attachment was scrubbed... URL: From info at rotnetix.com Fri Jan 9 02:52:20 2015 From: info at rotnetix.com (info at rotnetix.com) Date: Thu, 8 Jan 2015 18:52:20 -0800 (PST) Subject: [Haskell-cafe] Installing ihaskell on nixos In-Reply-To: References: <361d0f49-183c-480c-98f1-0663e52dbbf0@googlegroups.com> Message-ID: <9bfb590a-9236-4a3c-bd18-1687656f9e73@googlegroups.com> Thank you for the tip. I did that but then the ihaskell notebook failed to actually load haskell. so I added the following to the config file: c = get_config() c.KernelManager.kernel_cmd = [exe, 'kernel', '{connection_file}'] c.Session.key = b'' c.Session.keyfile = b'' # Syntax highlight properly in Haskell notebooks. c.NbConvertBase.default_language = "haskell" # Where to look for templates. template_path = "/".join(__file__.split("/")[:-1] + ["templates"]) c.TemplateExporter.template_path = [template_path] And every time I run the ihaskell notebook / console it also adds: exe = '/nix/store/hlkvkavkgm3hj08ffdlziq30r7zyr060-haskell-ihaskell-ghc7.8.3-0.4.3.0-shared/bin/IHaskell'.replace(' ', '\\ ') So I now have a whole list of these at the top. However now the kernel keeps crashing with : 2015-01-09 03:47:51.673 [NotebookApp] KernelRestarter: restarting kernel (1/5) WARNING:root:kernel 0d8057d4-b51e-4acc-a262-ceee9a84edee restarted IHaskell: Failed to load interface for ?IHaskell.Display? Use -v to see a list of the files searched for. Failed to load interface for ?IHaskell.Display? Use -v to see a list of the files searched for. Failed to load interface for ?IHaskell.IPython.Stdin? Use -v to see a list of the files searched for. Any ideas? On Thursday, January 8, 2015 at 8:09:03 PM UTC+11, Utku Demir wrote: > > I reproduced the issue, had ~/.ipython/profile_haskell directory, but not > ipython_config.py inside it after installation. > > I just created an empty file with `touch > ~/.ipython/profile_haskell/ipython_config.py` and then iHaskell started > successfully. > > On Thu Jan 08 2015 at 10:07:36 EET > > wrote: > >> I am trying to set up ihaskell on EC2. I start with the NixOs EC2 >> instance (from http://nixos.org/nixos/download.html) and then basically >> install the ihaskell package using nix-env -i ihaskell. The installation >> runs fine but when I try to start the notebook with ihaskell notebook i get >> the following: >> >> Updating IPython profile. >> Loading profile from >> /nix/store/hlkvkavkgm3hj08ffdlziq30r7zyr060-haskell-ihaskell-ghc7.8.3-0.4.3.0-shared/share/x86_64-linux-ghc-7.8.3/ihaskell-0.4.3.0/profile/profile.tar >> IHaskell: >> Ran commands: >> mkdir -p /root/.ihaskell >> mkdir -p /root/.ihaskell/notebooks >> mkdir -p /root/.ihaskell >> /nix/store/hnmgn0jrpzlp5d91m5xawpr2iqsjxh7j-ipython-2.3.1/bin/ipython >> locate profile haskell >> which >> /nix/store/hnmgn0jrpzlp5d91m5xawpr2iqsjxh7j-ipython-2.3.1/bin/ipython >> /nix/store/hnmgn0jrpzlp5d91m5xawpr2iqsjxh7j-ipython-2.3.1/bin/ipython >> locate profile haskell >> which >> /nix/store/hnmgn0jrpzlp5d91m5xawpr2iqsjxh7j-ipython-2.3.1/bin/ipython >> >> Exception: /root/.ipython/profile_haskell/ipython_config.py: openFile: >> does not exist (No such file or directory) >> >> I poked around a bit and the root/.ipython/profile_haskell/ contains none >> of the expected profile files... Could not find anything by googling >> around except the suggestion to run the ihaskell setup command which seems >> to have been discontinued >> >> Can anyone suggest what I could try? >> >> Thanks >> Riaan >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskel... at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From johan.tibell at gmail.com Fri Jan 9 13:55:06 2015 From: johan.tibell at gmail.com (Johan Tibell) Date: Fri, 9 Jan 2015 14:55:06 +0100 Subject: [Haskell-cafe] The amount of CPP we have to use is getting out of hand Message-ID: Hi, (This was initially written as a Google+ post, but I'm reposting it here to raise awareness of the issue.) The amount of CPP we have to use in Haskell is getting a bit out of hand. Here are the number of modules, per library, that use CPP for some of the libraries I maintain: containers 18/18 hashable 4/5 unordered-containers 6/9 network 3/7 cassava 4/16 cabal/cabal-install 13/75 cabal/Cabal 7/78 ekg 1/15 If this doesn't look like a lot to you (I hope it does!) consider than some languages don't use CPP at all (e.g. Java). CPP really sucks from a maintenance perspective: * It's not Haskell, but this bizarre string concatenation language. * The code is harder to read, bitrots more easily, and is harder to test. * The code can't be compiled without using Cabal (which generates some of the CPP macros for us.) This hurts e.g. ad-hoc testing/benchmarking. There are a couple of reasons we use CPP, but the main one is breaking changes in GHC and libraries we depend on. We need to reduce these kind of breakages in the future. Dealing with breakages and maintaining the resulting CPP-ed code is costing us time we could spend on other things, such as improving our libraries or writing new ones. I for one would like to get on with writing applications instead of spending time on run-of-the-mill libraries. Often these breaking changes are done in the name of "making things cleaner". Breaking changes, no matter how well-intended, doesn't make code cleaner, it makes it less clean*. Users end up having to use *both* the old "unclean" API *and* the new "clean" API. The right way to move to evolve an new API is to add new functions and data types, not modify old ones, whenever possible. * It takes about 3 major GHC releases (~3 years) before you can remove the CPP, but since new things keep breaking all the time you always have a considerable amount of CPP.? -- Johan -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Fri Jan 9 14:00:34 2015 From: michael at snoyman.com (Michael Snoyman) Date: Fri, 09 Jan 2015 14:00:34 +0000 Subject: [Haskell-cafe] The amount of CPP we have to use is getting out of hand References: Message-ID: +1, you have my full support and agreement. On Fri, Jan 9, 2015, 3:57 PM Johan Tibell wrote: > Hi, > > (This was initially written as a Google+ post, but I'm reposting it here > to raise awareness of the issue.) > > The amount of CPP we have to use in Haskell is getting a bit out of > hand. Here are the number of modules, per library, that use CPP for some of > the libraries I maintain: > > containers 18/18 > hashable 4/5 > unordered-containers 6/9 > network 3/7 > cassava 4/16 > cabal/cabal-install 13/75 > cabal/Cabal 7/78 > ekg 1/15 > > If this doesn't look like a lot to you (I hope it does!) consider than > some languages don't use CPP at all (e.g. Java). > > CPP really sucks from a maintenance perspective: > > * It's not Haskell, but this bizarre string concatenation language. > * The code is harder to read, bitrots more easily, and is harder to test. > * The code can't be compiled without using Cabal (which generates some of > the CPP macros for us.) This hurts e.g. ad-hoc testing/benchmarking. > > There are a couple of reasons we use CPP, but the main one is breaking > changes in GHC and libraries we depend on. We need to reduce these kind of > breakages in the future. Dealing with breakages and maintaining the > resulting CPP-ed code is costing us time we could spend on other things, > such as improving our libraries or writing new ones. I for one would like > to get on with writing applications instead of spending time on > run-of-the-mill libraries. > > Often these breaking changes are done in the name of "making things > cleaner". Breaking changes, no matter how well-intended, doesn't make code > cleaner, it makes it less clean*. Users end up having to use *both* the > old "unclean" API *and* the new "clean" API. > > The right way to move to evolve an new API is to add new functions and > data types, not modify old ones, whenever possible. > > * It takes about 3 major GHC releases (~3 years) before you can remove the > CPP, but since new things keep breaking all the time you always have a > considerable amount of CPP.? > > -- Johan > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hesselink at gmail.com Fri Jan 9 14:36:04 2015 From: hesselink at gmail.com (Erik Hesselink) Date: Fri, 9 Jan 2015 15:36:04 +0100 Subject: [Haskell-cafe] The amount of CPP we have to use is getting out of hand In-Reply-To: References: Message-ID: I agree in principle, however, I'm not sure how feasible it is in practice. I quickly grepped through some of our (internal and public) packages and checked why we need CPP (I only checked MIN_VERSION_foo macros): data type change: 11 newly added function/type: 6 added instance: 4 function change/rename: 3 function remove: 1 deprecated function: 1 As you can see, most instances are either data type changes (these are almost all in template haskell or haskell-src-exts) or newly added functions where we also want to support old versions without the function. So avoiding function changing or removing would reduce the CPP usage in our case by about 15%, which is welcome, but doesn't really change anything fundamental. For data type changes, I don't really see an alternative: if new features are added the AST changes, the AST type changes. For additions of functions, I guess we could use a local definition even for newer versions, but that makes it less clear when you can remove it. For instance additions, I again see no alternative. So while I think we can do slightly better, and I would love it if that happened, it's probably not going to be significant. Erik P.S. Just to add some more data, here's the packages where CPPing for: 9 base 7 template_haskell 4 network 4 haskell_src_exts 2 uuid 2 time 1 wai 1 json_schema 1 containers 1 HTTP On Fri, Jan 9, 2015 at 3:00 PM, Michael Snoyman wrote: > +1, you have my full support and agreement. > > > On Fri, Jan 9, 2015, 3:57 PM Johan Tibell wrote: >> >> Hi, >> >> (This was initially written as a Google+ post, but I'm reposting it here >> to raise awareness of the issue.) >> >> The amount of CPP we have to use in Haskell is getting a bit out of hand. >> Here are the number of modules, per library, that use CPP for some of the >> libraries I maintain: >> >> containers 18/18 >> hashable 4/5 >> unordered-containers 6/9 >> network 3/7 >> cassava 4/16 >> cabal/cabal-install 13/75 >> cabal/Cabal 7/78 >> ekg 1/15 >> >> If this doesn't look like a lot to you (I hope it does!) consider than >> some languages don't use CPP at all (e.g. Java). >> >> CPP really sucks from a maintenance perspective: >> >> * It's not Haskell, but this bizarre string concatenation language. >> * The code is harder to read, bitrots more easily, and is harder to test. >> * The code can't be compiled without using Cabal (which generates some of >> the CPP macros for us.) This hurts e.g. ad-hoc testing/benchmarking. >> >> There are a couple of reasons we use CPP, but the main one is breaking >> changes in GHC and libraries we depend on. We need to reduce these kind of >> breakages in the future. Dealing with breakages and maintaining the >> resulting CPP-ed code is costing us time we could spend on other things, >> such as improving our libraries or writing new ones. I for one would like to >> get on with writing applications instead of spending time on run-of-the-mill >> libraries. >> >> Often these breaking changes are done in the name of "making things >> cleaner". Breaking changes, no matter how well-intended, doesn't make code >> cleaner, it makes it less clean*. Users end up having to use both the old >> "unclean" API and the new "clean" API. >> >> The right way to move to evolve an new API is to add new functions and >> data types, not modify old ones, whenever possible. >> >> * It takes about 3 major GHC releases (~3 years) before you can remove the >> CPP, but since new things keep breaking all the time you always have a >> considerable amount of CPP.? >> >> -- Johan >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From johan.tibell at gmail.com Fri Jan 9 14:46:08 2015 From: johan.tibell at gmail.com (Johan Tibell) Date: Fri, 9 Jan 2015 15:46:08 +0100 Subject: [Haskell-cafe] The amount of CPP we have to use is getting out of hand In-Reply-To: References: Message-ID: If anyone would like to compute the CPP usage for your modules, you can use this command: for lib in hashable cabal/Cabal cabal/cabal-install containers unordered-containers cassava ekg network; do echo $lib find $lib -type d \( -name tests -o -name benchmarks -o -name dist -o -name .cabal-sandbox -o -name tests-ghc \) -prune \ -o -name Setup.hs -prune -o -name '*.hs' -exec grep -l 'LANGUAGE.*CPP' {} \; | wc -l find $lib -type d \( -name tests -o -name benchmarks -o -name dist -o -name .cabal-sandbox -o -name tests-ghc \) -prune \ -o -name Setup.hs -prune -o -name '*.hs' -print | wc -l done Replace the list in the 'in' clause with your list of packages (which should all be in a per-package directory under $CWD). On Fri, Jan 9, 2015 at 2:55 PM, Johan Tibell wrote: > Hi, > > (This was initially written as a Google+ post, but I'm reposting it here > to raise awareness of the issue.) > > The amount of CPP we have to use in Haskell is getting a bit out of > hand. Here are the number of modules, per library, that use CPP for some of > the libraries I maintain: > > containers 18/18 > hashable 4/5 > unordered-containers 6/9 > network 3/7 > cassava 4/16 > cabal/cabal-install 13/75 > cabal/Cabal 7/78 > ekg 1/15 > > If this doesn't look like a lot to you (I hope it does!) consider than > some languages don't use CPP at all (e.g. Java). > > CPP really sucks from a maintenance perspective: > > * It's not Haskell, but this bizarre string concatenation language. > * The code is harder to read, bitrots more easily, and is harder to test. > * The code can't be compiled without using Cabal (which generates some of > the CPP macros for us.) This hurts e.g. ad-hoc testing/benchmarking. > > There are a couple of reasons we use CPP, but the main one is breaking > changes in GHC and libraries we depend on. We need to reduce these kind of > breakages in the future. Dealing with breakages and maintaining the > resulting CPP-ed code is costing us time we could spend on other things, > such as improving our libraries or writing new ones. I for one would like > to get on with writing applications instead of spending time on > run-of-the-mill libraries. > > Often these breaking changes are done in the name of "making things > cleaner". Breaking changes, no matter how well-intended, doesn't make code > cleaner, it makes it less clean*. Users end up having to use *both* the > old "unclean" API *and* the new "clean" API. > > The right way to move to evolve an new API is to add new functions and > data types, not modify old ones, whenever possible. > > * It takes about 3 major GHC releases (~3 years) before you can remove the > CPP, but since new things keep breaking all the time you always have a > considerable amount of CPP.? > > -- Johan > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From johan.tibell at gmail.com Fri Jan 9 14:51:01 2015 From: johan.tibell at gmail.com (Johan Tibell) Date: Fri, 9 Jan 2015 15:51:01 +0100 Subject: [Haskell-cafe] The amount of CPP we have to use is getting out of hand In-Reply-To: References: Message-ID: To complete the list, here are my other three packages: network-uri 1/1 ekg-statsd 1/3 ekg-core 1/8 On Fri, Jan 9, 2015 at 3:46 PM, Johan Tibell wrote: > If anyone would like to compute the CPP usage for your modules, you can > use this command: > > for lib in hashable cabal/Cabal cabal/cabal-install containers > unordered-containers cassava ekg network; do > echo $lib > find $lib -type d \( -name tests -o -name benchmarks -o -name dist -o > -name .cabal-sandbox -o -name tests-ghc \) -prune \ > -o -name Setup.hs -prune -o -name '*.hs' -exec grep -l 'LANGUAGE.*CPP' > {} \; | wc -l > find $lib -type d \( -name tests -o -name benchmarks -o -name dist -o > -name .cabal-sandbox -o -name tests-ghc \) -prune \ > -o -name Setup.hs -prune -o -name '*.hs' -print | wc -l > done > > Replace the list in the 'in' clause with your list of packages (which > should all be in a per-package directory under $CWD). > > On Fri, Jan 9, 2015 at 2:55 PM, Johan Tibell > wrote: > >> Hi, >> >> (This was initially written as a Google+ post, but I'm reposting it here >> to raise awareness of the issue.) >> >> The amount of CPP we have to use in Haskell is getting a bit out of >> hand. Here are the number of modules, per library, that use CPP for some of >> the libraries I maintain: >> >> containers 18/18 >> hashable 4/5 >> unordered-containers 6/9 >> network 3/7 >> cassava 4/16 >> cabal/cabal-install 13/75 >> cabal/Cabal 7/78 >> ekg 1/15 >> >> If this doesn't look like a lot to you (I hope it does!) consider than >> some languages don't use CPP at all (e.g. Java). >> >> CPP really sucks from a maintenance perspective: >> >> * It's not Haskell, but this bizarre string concatenation language. >> * The code is harder to read, bitrots more easily, and is harder to test. >> * The code can't be compiled without using Cabal (which generates some >> of the CPP macros for us.) This hurts e.g. ad-hoc testing/benchmarking. >> >> There are a couple of reasons we use CPP, but the main one is breaking >> changes in GHC and libraries we depend on. We need to reduce these kind of >> breakages in the future. Dealing with breakages and maintaining the >> resulting CPP-ed code is costing us time we could spend on other things, >> such as improving our libraries or writing new ones. I for one would like >> to get on with writing applications instead of spending time on >> run-of-the-mill libraries. >> >> Often these breaking changes are done in the name of "making things >> cleaner". Breaking changes, no matter how well-intended, doesn't make code >> cleaner, it makes it less clean*. Users end up having to use *both* the >> old "unclean" API *and* the new "clean" API. >> >> The right way to move to evolve an new API is to add new functions and >> data types, not modify old ones, whenever possible. >> >> * It takes about 3 major GHC releases (~3 years) before you can remove >> the CPP, but since new things keep breaking all the time you always have a >> considerable amount of CPP.? >> >> -- Johan >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicola.gigante at gmail.com Fri Jan 9 17:59:18 2015 From: nicola.gigante at gmail.com (Nicola Gigante) Date: Fri, 9 Jan 2015 18:59:18 +0100 Subject: [Haskell-cafe] The amount of CPP we have to use is getting out of hand In-Reply-To: References: Message-ID: <201103D2-E172-4BCA-B4A0-B6A52A1F75CE@gmail.com> > Il giorno 09/gen/2015, alle ore 14:55, Johan Tibell ha scritto: > > Hi, > > (This was initially written as a Google+ post, but I'm reposting it here to raise awareness of the issue.) > > The amount of CPP we have to use in Haskell is getting a bit out of hand. Here are the number of modules, per library, that use CPP for some of the libraries I maintain: > > containers 18/18 > hashable 4/5 > unordered-containers 6/9 > network 3/7 > cassava 4/16 > cabal/cabal-install 13/75 > cabal/Cabal 7/78 > ekg 1/15 > > If this doesn't look like a lot to you (I hope it does!) consider than some languages don't use CPP at all (e.g. Java). > > CPP really sucks from a maintenance perspective: > > * It's not Haskell, but this bizarre string concatenation language. > * The code is harder to read, bitrots more easily, and is harder to test. > * The code can't be compiled without using Cabal (which generates some of the CPP macros for us.) This hurts e.g. ad-hoc testing/benchmarking. > > There are a couple of reasons we use CPP, but the main one is breaking changes in GHC and libraries we depend on. We need to reduce these kind of breakages in the future. Dealing with breakages and maintaining the resulting CPP-ed code is costing us time we could spend on other things, such as improving our libraries or writing new ones. I for one would like to get on with writing applications instead of spending time on run-of-the-mill libraries. > > Often these breaking changes are done in the name of "making things cleaner". Breaking changes, no matter how well-intended, doesn't make code cleaner, it makes it less clean*. Users end up having to use both the old "unclean" API and the new "clean" API. > > The right way to move to evolve an new API is to add new functions and data types, not modify old ones, whenever possible. > > * It takes about 3 major GHC releases (~3 years) before you can remove the CPP, but since new things keep breaking all the time you always have a considerable amount of CPP.? > Hi I?m an outsider so this could probably sound ingenuous but, why not thinking about an in-language feature to solve the problems addressed by CPP? I think these all fall into: Enable some top-level declaration only if the XYZ feature is available. This feature should allow the user to specify different definitions of the same symbol depending on the availability of compiler features but also _modules_ features. So if I can declare and export a newFunc function from my module only if DataKinds is supported, I can do it explicitly instead of relying on GHC version X.Y.Z. On the other hand, the users of my module can decide if they want to compile some code depending on the fact that my module exports the function or not. This should not be limited to ?the module exports the function?. Other types of ?features? could be tested over, and modules should be able to declare the new features added which deserve to be tested in this way. For example, if in the 2.0 version of my module I?ve increased the laziness of my data structure, I can export the feature ?MyModule.myFunc is lazy? (encoded in some way). Then the user can decide which implementation of its algorithm to use depending on this. I think a system like this should solve the majority of maintenance burden because: - Dependencies on libraries features are explicit and the version numbers needed to support them can be inferred by cabal. For example cabal could support a syntax like containers(with:foo_is_lazy) instead of containers >= x.y.z - GHC can automatically warn about features that are supported by all the currently supported versions of GHC so that the checks can be removed. - Code is more testable because the test suite could run tests multiple times, each time ?faking? the availability of certain features, with the GHC support of a ?fake old version mode? where it has simply to pretend to not know the existence of a certain extension (not at all a ?compatibility mode?, to be clear). As for library features, integrating with cabal sandboxes one could automatically switch library versions to run the test with. - Other? I repeat: I?m an outsider of the world of maintenance of the haskell packages, so I could be missing something obvious. Hope this can be useful though. > ? Johan Bye, Nicola -------------- next part -------------- An HTML attachment was scrubbed... URL: From dsf at seereason.com Fri Jan 9 21:51:08 2015 From: dsf at seereason.com (David Fox) Date: Fri, 9 Jan 2015 13:51:08 -0800 Subject: [Haskell-cafe] The amount of CPP we have to use is getting out of hand In-Reply-To: <201103D2-E172-4BCA-B4A0-B6A52A1F75CE@gmail.com> References: <201103D2-E172-4BCA-B4A0-B6A52A1F75CE@gmail.com> Message-ID: I wonder how much of the CPP functionality could be implemented using template haskell? -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at orlitzky.com Fri Jan 9 22:24:12 2015 From: michael at orlitzky.com (Michael Orlitzky) Date: Fri, 09 Jan 2015 17:24:12 -0500 Subject: [Haskell-cafe] The amount of CPP we have to use is getting out of hand In-Reply-To: References: Message-ID: <54B0550C.4010902@orlitzky.com> On 01/09/2015 08:55 AM, Johan Tibell wrote: > Hi, > > (This was initially written as a Google+ post, but I'm reposting it here to > raise awareness of the issue.) > > The amount of CPP we have to use in Haskell is getting a bit out of > hand. Here are the number of modules, per library, that use CPP for some of > the libraries I maintain: > > containers 18/18 > hashable 4/5 > unordered-containers 6/9 > network 3/7 > cassava 4/16 > cabal/cabal-install 13/75 > cabal/Cabal 7/78 > ekg 1/15 I looked at a few of these, and some of the CPP could be avoided. Whether or not the alternatives involve more work -- well, you be the judge. 1. TESTING constant. Here CPP is used to export internal stuff during testing, for example: module Data.Set ( #if !defined(TESTING) Set #else Set(..) #endif This allows you to put the tests in a separate module, but give them access to internal functions. I'm torn on which solution is better, but I've settled on putting the tests in the module with the functions they test. You then have to depend on e.g. tasty, but who cares -- Cabal should be running the test suites anyway and bail out if they fail. That's (half of..) what they're for. You also have to import the Test.Crap in each module, but this bothers me less than I thought it would. If you use doctest to test your examples, then those tests have to go in the module with the functions themselves, so at that point there's no additional uncleanliness felt. 2. Optionally enable new features with newer GHCs. One example: #if MIN_VERSION_base(4,8,0) import Data.Coerce #endif These are better addressed with git branches. Do your development on the master branch targeting the latest GHC, but also keep a branch for older GHC. The master branch would have "import Data.Coerce", but the "old_ghc" branch would not. It doesn't produce much extra work -- git is designed to do exactly this. Whenever you make a new commit on master, it's trivial to merge it back into the old_ghc branch. Suppose your library foo is at version 1.5.0 when a new GHC is released. You can use the master branch for 1.6.0, using the new features. The next time you make a release, just release two new packages: 1.5.1 and 1.6.1 that target the old and new GHC respectively. This way you at least *work* off of a clean code base. Your new tricks in the master branch just look like a patch on top of what's in the old_ghc branch. From achudnov at gmail.com Fri Jan 9 22:45:25 2015 From: achudnov at gmail.com (Andrey Chudnov) Date: Fri, 09 Jan 2015 17:45:25 -0500 Subject: [Haskell-cafe] The amount of CPP we have to use is getting out of hand In-Reply-To: References: Message-ID: <54B05A05.2000305@gmail.com> Johan, I hear and agree. Even though I've never used CPP in my packages, I've read code that does ---and it's horrible. And I, too, have experienced new GHC stable versions breaking foundational libraries, including Cabal. But, my impression was that most of these breakages are due to certain GHC extensions being deprecated, and not because the compiler stops respecting the standard. Is my understanding correct? If so, then why not disable extensions and limit yourself to Haskell 2010? Yes, you get used to the good stuff quickly, and it's painful to give it up --- but isn't that what standards are for? From acowley at seas.upenn.edu Fri Jan 9 23:14:40 2015 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Fri, 9 Jan 2015 18:14:40 -0500 Subject: [Haskell-cafe] PSA regarding Cabal-1.22 and ghc-mod Message-ID: I was lucky to avoid this myself, but I keep seeing it crop up: ghc-mod doesn't work with GHC < 7.10 and Cabal-1.22. If you are still on GHC 7.8.3 or 7.8.4, you may want to hold off on updating cabal or cabal-install. This isn't really my news to report, but folks need to know. See this issue for more information: https://github.com/kazu-yamamoto/ghc-mod/issues/417#issuecomment-68819938 Anthony From thomas.dubuisson at gmail.com Fri Jan 9 23:17:13 2015 From: thomas.dubuisson at gmail.com (Thomas DuBuisson) Date: Fri, 9 Jan 2015 15:17:13 -0800 Subject: [Haskell-cafe] The amount of CPP we have to use is getting out of hand In-Reply-To: <54B05A05.2000305@gmail.com> References: <54B05A05.2000305@gmail.com> Message-ID: It is not my experience that encouraging stagnation in library APIs will either reduce CPP or improve the community. My project modules using CPP: 0/12 0/6 3/9 - Changes to base/tagged, conditionally including expensive code needed by few users 10/116 - gmp arch specific issues, RecursiveDo vs DoRec, bitSizeMaybe, debug trace 0/7 4/5 - Platform specific code selection 0/1 0/7 1/4 - Architecture specific unsafeness for performance gains 5/207 - File and line number enhanced error messages 0/1 On Fri, Jan 9, 2015 at 2:45 PM, Andrey Chudnov wrote: > Johan, > I hear and agree. Even though I've never used CPP in my packages, I've read > code that does ---and it's horrible. And I, too, have experienced new GHC > stable versions breaking foundational libraries, including Cabal. But, my > impression was that most of these breakages are due to certain GHC > extensions being deprecated, and not because the compiler stops respecting > the standard. Is my understanding correct? If so, then why not disable > extensions and limit yourself to Haskell 2010? Yes, you get used to the good > stuff quickly, and it's painful to give it up --- but isn't that what > standards are for? > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From ben at smart-cactus.org Fri Jan 9 23:48:03 2015 From: ben at smart-cactus.org (Ben Gamari) Date: Fri, 09 Jan 2015 18:48:03 -0500 Subject: [Haskell-cafe] The amount of CPP we have to use is getting out of hand In-Reply-To: <201103D2-E172-4BCA-B4A0-B6A52A1F75CE@gmail.com> References: <201103D2-E172-4BCA-B4A0-B6A52A1F75CE@gmail.com> Message-ID: <87mw5rzfbg.fsf@gmail.com> Nicola Gigante writes: >> Il giorno 09/gen/2015, alle ore 14:55, Johan Tibell ha scritto: >> >> Hi, >> >> (This was initially written as a Google+ post, but I'm reposting it >> here to raise awareness of the issue.) >> >> The amount of CPP we have to use in Haskell is getting a bit out of >> hand. Here are the number of modules, per library, that use CPP for >> some of the libraries I maintain: >> [snip] > Hi > > I?m an outsider so this could probably sound ingenuous but, > why not thinking about an in-language feature to solve the > problems addressed by CPP? > This might be a good time to bring in the data point provided by Rust [1], where the attribute system to allow conditional compilation. For instance, #[cfg(not(a_feature))] pub fn my_function() { ... } #[cfg(a_feature)] pub fn my_function() { ... } The build system can then detect whether the feature in question is available, and potentially pass `-f a_feature` to the compiler. `cfg` items can also have string values which can be tested for equality (although I think they intend on extending this at some point). This works well for them as it is flexible and fits nicely into the language, reusing the attribute syntax that Rust users are already familiar with. The closest thing Haskell has to this is the conventional `{-# ... #-}` pragma syntax, but leveraging this would almost certainly require compiler support and a language extension. Cheers, - Ben [1] http://doc.rust-lang.org/reference.html#conditional-compilation -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 472 bytes Desc: not available URL: From sportano at gmail.com Sat Jan 10 02:02:30 2015 From: sportano at gmail.com (Stephen Portanova) Date: Fri, 9 Jan 2015 18:02:30 -0800 Subject: [Haskell-cafe] Deploying Scotty App to AWS Message-ID: I'm having trouble running my Scotty binary on amazon web services... I'm using Ubuntu 15.04, this gist (https://gist.github.com/yantonov/10083524) to install the haskell platform dependencies, and then I do a git pull to my repo and build my binary. Everything compiles, but when I do ./cabal-sandbox/bin/app or ./dist/build/app/app, nothing happens. No error messages or anything - the terminal just goes to the next line and hangs (on my Mac development machine the server starts up fine and prints a startup message). Any ideas or experience with deploying Scotty / Haskell apps would be really appreciated, thanks! - Stephen -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Sat Jan 10 02:24:39 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Fri, 9 Jan 2015 21:24:39 -0500 Subject: [Haskell-cafe] Deploying Scotty App to AWS In-Reply-To: References: Message-ID: On Fri, Jan 9, 2015 at 9:02 PM, Stephen Portanova wrote: > Everything compiles, but when I do ./cabal-sandbox/bin/app or > > ./dist/build/app/app, nothing happens. No error messages or anything - the > terminal just goes to the next line and hangs (on my Mac development > machine the server starts up fine and prints a startup message). > > I'd be interested in seeing strace output, if nobody else has any idea. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From anton.kholomiov at gmail.com Sat Jan 10 10:49:15 2015 From: anton.kholomiov at gmail.com (Anton Kholomiov) Date: Sat, 10 Jan 2015 14:49:15 +0400 Subject: [Haskell-cafe] new haskell music track: Mother Is Waiting Message-ID: Dear Haskellers I'd like to present yet another piece of music made in Haskell. https://soundcloud.com/anton-kho/mother-is-waiting It's very soothing piece that can be used as a helper for dreaming or meditation. It's dedicated to my friend. She's waiting for her second child to be born. This time it contains no samples. All sounds are made out of waves and filters. So I can attach the source code right in the mail. The track relies on new versions of the packages `csound-expression`, `csound-sampler` and `csound-catalog`. So you can do > cabal update > cabal install csound-sampler csound-catalog Ad the we can load the file in the ghci and run the main function. > ghci Mother.hs > main and the Csound should be installed to render the synths. Cheers, Anton -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Mother.hs Type: application/octet-stream Size: 2913 bytes Desc: not available URL: From k-bx at k-bx.com Sat Jan 10 12:28:46 2015 From: k-bx at k-bx.com (Konstantine Rybnikov) Date: Sat, 10 Jan 2015 14:28:46 +0200 Subject: [Haskell-cafe] Deploying Scotty App to AWS In-Reply-To: References: Message-ID: Also, just for making this super-clear to reproduce, I would advice to express a problem as a Dockerfile that lets you reproduce the problem in a one command. Thanks. On Sat, Jan 10, 2015 at 4:02 AM, Stephen Portanova wrote: > I'm having trouble running my Scotty binary on amazon web services... > > I'm using Ubuntu 15.04, this gist ( > https://gist.github.com/yantonov/10083524) to install the haskell > platform dependencies, and then I do a git pull to my repo and build my > binary. > > Everything compiles, but when I do ./cabal-sandbox/bin/app or > > ./dist/build/app/app, nothing happens. No error messages or anything - the > terminal just goes to the next line and hangs (on my Mac development > machine the server starts up fine and prints a startup message). > > Any ideas or experience with deploying Scotty / Haskell apps would be > really appreciated, thanks! > > - Stephen > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffbrown.the at gmail.com Sat Jan 10 21:05:29 2015 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Sat, 10 Jan 2015 13:05:29 -0800 Subject: [Haskell-cafe] new haskell music track: Mother Is Waiting In-Reply-To: References: Message-ID: Aside from the Haskell libraries for CSound, does one also have to have CSound itself installed? On Sat, Jan 10, 2015 at 2:49 AM, Anton Kholomiov wrote: > Dear Haskellers I'd like to present yet another > piece of music made in Haskell. > > https://soundcloud.com/anton-kho/mother-is-waiting > > It's very soothing piece that can be used as a helper for > dreaming or meditation. It's dedicated to my friend. > She's waiting for her second child to be born. > > This time it contains > no samples. All sounds are made out of waves and filters. > So I can attach the source code right in the mail. The track relies on new > versions > of the packages `csound-expression`, `csound-sampler` and `csound-catalog`. > So you can do > > > cabal update > > cabal install csound-sampler csound-catalog > > Ad the we can load the file in the ghci and run the main function. > > > ghci Mother.hs > > main > > and the Csound should be installed to render the synths. > > Cheers, Anton > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fa-ml at ariis.it Sat Jan 10 22:44:28 2015 From: fa-ml at ariis.it (Francesco Ariis) Date: Sat, 10 Jan 2015 23:44:28 +0100 Subject: [Haskell-cafe] new haskell music track: Mother Is Waiting In-Reply-To: References: Message-ID: <20150110224428.GA3892@x60s.casa> On Sat, Jan 10, 2015 at 01:05:29PM -0800, Jeffrey Brown wrote: > Aside from the Haskell libraries for CSound, does one also have to have > CSound itself installed? Yes, there is a friendly tutorial here [1]. [1] https://github.com/anton-k/csound-expression/blob/master/tutorial/chapters/appendix/QuickStart.markdown From sportano at gmail.com Sun Jan 11 03:15:11 2015 From: sportano at gmail.com (Stephen Portanova) Date: Sat, 10 Jan 2015 19:15:11 -0800 Subject: [Haskell-cafe] Deploying Scotty App to AWS In-Reply-To: References: Message-ID: Update: I found out that it works when I use normal scotty, but not when I use scottyTLS. When I use scottyTLS, it prints "starting up", but doesn't get to "getting here". No error messages [image: Inline image 1] @Konstantine: Just learned how to do Docker - very cool! Here's my image - it's an ubuntu 14.04. https://registry.hub.docker.com/u/sportanova/starme/ To run, do these commands: source /root/.profile /starme/StarMe/dist/dist-sandbox-2c59b82/build/starz/starz "test.key" "test.cert" @Brandon: I tried running sudo strace , but I got the error: trace: test_ptrace_setoptions_followfork: PTRACE_TRACEME doesn't work: Permission denied strace: test_ptrace_setoptions_followfork: unexpected exit status 1 Thanks Konstantine + Brandon! On Sat, Jan 10, 2015 at 4:28 AM, Konstantine Rybnikov wrote: > Also, just for making this super-clear to reproduce, I would advice to > express a problem as a Dockerfile that lets you reproduce the problem in a > one command. > > Thanks. > > On Sat, Jan 10, 2015 at 4:02 AM, Stephen Portanova > wrote: > >> I'm having trouble running my Scotty binary on amazon web services... >> >> I'm using Ubuntu 15.04, this gist ( >> https://gist.github.com/yantonov/10083524) to install the haskell >> platform dependencies, and then I do a git pull to my repo and build my >> binary. >> >> Everything compiles, but when I do ./cabal-sandbox/bin/app or >> >> ./dist/build/app/app, nothing happens. No error messages or anything - >> the terminal just goes to the next line and hangs (on my Mac development >> machine the server starts up fine and prints a startup message). >> >> Any ideas or experience with deploying Scotty / Haskell apps would be >> really appreciated, thanks! >> >> - Stephen >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > -- Stephen Portanova (480) 495-2634 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 33535 bytes Desc: not available URL: From lambda.fairy at gmail.com Sun Jan 11 04:15:25 2015 From: lambda.fairy at gmail.com (Chris Wong) Date: Sun, 11 Jan 2015 17:15:25 +1300 Subject: [Haskell-cafe] Deploying Scotty App to AWS In-Reply-To: References: Message-ID: Hi Stephen, On Sun, Jan 11, 2015 at 4:15 PM, Stephen Portanova wrote: > Update: I found out that it works when I use normal scotty, but not when I use scottyTLS. When I use scottyTLS, it prints "starting up", but doesn't get to "getting here". No error messages Really shooting in the dark here... but could it be a lack of entropy? crypto-random (which scotty-tls depends on) seems to favor /dev/random [1], which can block. Chris [1] http://hackage.haskell.org/package/crypto-random-0.0.8/docs/src/Crypto-Random-Entropy.html#supportedBackends > @Konstantine: Just learned how to do Docker - very cool! Here's my image - it's an ubuntu 14.04. https://registry.hub.docker.com/u/sportanova/starme/ > > To run, do these commands: > > source /root/.profile > > /starme/StarMe/dist/dist-sandbox-2c59b82/build/starz/starz "test.key" "test.cert" > > > @Brandon: I tried running sudo strace , but I got the error: > > trace: test_ptrace_setoptions_followfork: PTRACE_TRACEME doesn't work: Permission denied > > strace: test_ptrace_setoptions_followfork: unexpected exit status 1 > > > Thanks Konstantine + Brandon! > > > On Sat, Jan 10, 2015 at 4:28 AM, Konstantine Rybnikov wrote: >> >> Also, just for making this super-clear to reproduce, I would advice to express a problem as a Dockerfile that lets you reproduce the problem in a one command. >> >> Thanks. >> >> On Sat, Jan 10, 2015 at 4:02 AM, Stephen Portanova wrote: >>> >>> I'm having trouble running my Scotty binary on amazon web services... >>> >>> I'm using Ubuntu 15.04, this gist (https://gist.github.com/yantonov/10083524) to install the haskell platform dependencies, and then I do a git pull to my repo and build my binary. >>> >>> Everything compiles, but when I do ./cabal-sandbox/bin/app or >>> >>> ./dist/build/app/app, nothing happens. No error messages or anything - the terminal just goes to the next line and hangs (on my Mac development machine the server starts up fine and prints a startup message). >>> >>> Any ideas or experience with deploying Scotty / Haskell apps would be really appreciated, thanks! >>> >>> >>> - Stephen >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>> >> > > > > -- > Stephen Portanova > (480) 495-2634 > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- https://lambda.xyz From abela at chalmers.se Sun Jan 11 09:21:56 2015 From: abela at chalmers.se (Andreas Abel) Date: Sun, 11 Jan 2015 10:21:56 +0100 Subject: [Haskell-cafe] new haskell music track: Mother Is Waiting In-Reply-To: References: Message-ID: <54B240B4.7000303@chalmers.se> I was curious to listen, but it does not seem to work under ubuntu LTS 12.04. Probably the shipped version of Csound (May 30 2012) is too old: *Main> main virtual_keyboard real time MIDI plugin for Csound PortAudio real-time audio module for Csound 0dBFS level = 32768.0 Csound version 5.17 (double samples) May 30 2012 libsndfile-1.0.25 WARNING: could not open library '/usr/lib/csound/plugins64-5.2/libpmidi.so' (libportmidi.so.0: cannot open shared object file: No such file or directory) WARNING: could not open library '/usr/lib/csound/plugins64-5.2/libosc.so' (liblo.so.7: cannot open shared object file: No such file or directory) WARNING: could not open library '/usr/lib/csound/plugins64-5.2/libfluidOpcodes.so' (libfluidsynth.so.1: cannot open shared object file: No such file or directory) UnifiedCSD: tmp.csd STARTING FILE Creating options Creating orchestra Creating score RAWWAVE_PATH: /usr/share/stk/rawwaves/ rtaudio: PortAudio module enabled ... using blocking interface graph init orch compiler: opcode FreePort i 0 instr 92 instr 91 instr 90 instr 89 error: expression syntax insufficient terms: (2.0^-1) instr 88 instr 87 instr 86 instr 85 instr 84 instr 83 instr 82 instr 81 instr 80 instr 79 instr 78 instr 77 instr 76 instr 75 instr 74 instr 73 instr 72 instr 71 instr 70 instr 69 instr 68 instr 67 instr 66 instr 65 instr 64 instr 63 instr 62 instr 61 instr 60 instr 59 instr 58 instr 57 instr 56 instr 55 instr 54 instr 53 instr 52 instr 51 instr 50 instr 49 instr 48 instr 47 instr 46 instr 45 instr 44 instr 43 instr 42 instr 41 instr 40 instr 39 instr 38 instr 37 instr 36 instr 35 instr 34 instr 33 instr 32 instr 31 instr 30 instr 29 instr 28 instr 27 instr 26 instr 25 instr 24 instr 23 instr 22 error: expression syntax insufficient terms: (2.0^-1) instr 21 instr 20 instr 19 instr 18 2 syntax errors in orchestra. compilation invalid *Main> On 10.01.2015 11:49, Anton Kholomiov wrote: > Dear Haskellers I'd like to present yet another > piece of music made in Haskell. > > https://soundcloud.com/anton-kho/mother-is-waiting > > It's very soothing piece that can be used as a helper for > dreaming or meditation. It's dedicated to my friend. > She's waiting for her second child to be born. > > This time it contains > no samples. All sounds are made out of waves and filters. > So I can attach the source code right in the mail. The track relies on > new versions > of the packages `csound-expression`, `csound-sampler` and `csound-catalog`. > So you can do > > > cabal update > > cabal install csound-sampler csound-catalog > > Ad the we can load the file in the ghci and run the main function. > > > ghci Mother.hs > > main > > and the Csound should be installed to render the synths. > > Cheers, Anton > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Andreas Abel <>< Du bist der geliebte Mensch. Department of Computer Science and Engineering Chalmers and Gothenburg University, Sweden andreas.abel at gu.se http://www2.tcs.ifi.lmu.de/~abel/ From trupill at gmail.com Sun Jan 11 10:06:35 2015 From: trupill at gmail.com (Alejandro Serrano Mena) Date: Sun, 11 Jan 2015 11:06:35 +0100 Subject: [Haskell-cafe] ghc-mod split feature In-Reply-To: <54A86C61.9060303@gmx.net> References: <54A86C61.9060303@gmx.net> Message-ID: Dear Tobias, When calling "split" in GHC, you should point at the beginning of the variable you want to split on. In this case, try using $ ghc-mod split src/Foo.hs Foo 47 3 instead. This should make it work :) 2015-01-03 23:25 GMT+01:00 Tobias Pflug : > Hi, > > i just wanted to try some of the ghcmod features that I haven't used > before in order to hopefully add them to my vim haskell workflow somehow. > > What I apparently can't get to work is the split command: > > $ ghc-mod split src/Foo.hs Foo 47 7 > > which points to exactly the code listed in the ghc-mod help: > > f :: [a] -> a > f x = _ > > It does however not yield any output at all. Am I missing something > obvious here ? I'm using version 5.2.1.1 > > Thanks, > Tobi > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aditya.siram at gmail.com Sun Jan 11 18:39:40 2015 From: aditya.siram at gmail.com (aditya siram) Date: Sun, 11 Jan 2015 12:39:40 -0600 Subject: [Haskell-cafe] FLTK bindings near completion. Need community assistance ... Message-ID: Hi all, I've been working on bindings [1] to the FLTK GUI toolkit [2] and I've come to the point where it's mostly complete but I could use some help from the community before I put it up on Hackage. My hope is to eventually fill the need in the Haskell ecosystem for a native GUI library that: - runs on all platforms - is easily installable - is small and fast - has a minimum of dependencies. Currently this library uses only base, stm, bytestring and c2hs. - is conservative with extensions. Currently the most recent extension required is GADTs. If any of this sounds good to you, I could use some help with: - testing the build on Linux and OSX. This should be as simple as installing FLTK, cloning the repo [1] and running `cabal build`. Better instructions are in included README. - getting it to build on Windows. I unfortunately don't have access to a Windows machine. - getting it to build on older GHC's. I used 7.8.3 because that is what I have, but it should work back to the first version of GHC that introduced GADTs. Unfortunately the included `Setup.hs` is non-trivial and I been having trouble getting it work with versions of Cabal older than 1.20 due to breaking API changes across versions. - building a single library. Currently the C/C++ wrappers and Haskell bindings are two separate statically linked libraries. They are copied to the same location so applications built with this package don't have to know that, but it would be ideal if it was all-in-one. - building a shared library on Mac OSX. Any other feedback you have is totally welcome. Thanks! -deech [1] https://github.com/deech/fltkhs [2] http://www.fltk.org/index.php -------------- next part -------------- An HTML attachment was scrubbed... URL: From sportano at gmail.com Mon Jan 12 00:55:03 2015 From: sportano at gmail.com (Stephen Portanova) Date: Sun, 11 Jan 2015 16:55:03 -0800 Subject: [Haskell-cafe] Deploying Scotty App to AWS In-Reply-To: References: Message-ID: Chris, thanks for the response! Is there anything I can do to test / work around that theory? On Sat, Jan 10, 2015 at 8:15 PM, Chris Wong wrote: > Hi Stephen, > > On Sun, Jan 11, 2015 at 4:15 PM, Stephen Portanova > wrote: > > Update: I found out that it works when I use normal scotty, but not when > I use scottyTLS. When I use scottyTLS, it prints "starting up", but doesn't > get to "getting here". No error messages > > Really shooting in the dark here... but could it be a lack of entropy? > crypto-random (which scotty-tls depends on) seems to favor /dev/random > [1], which can block. > > Chris > > [1] > http://hackage.haskell.org/package/crypto-random-0.0.8/docs/src/Crypto-Random-Entropy.html#supportedBackends > > > @Konstantine: Just learned how to do Docker - very cool! Here's my image > - it's an ubuntu 14.04. > https://registry.hub.docker.com/u/sportanova/starme/ > > > > To run, do these commands: > > > > source /root/.profile > > > > /starme/StarMe/dist/dist-sandbox-2c59b82/build/starz/starz "test.key" > "test.cert" > > > > > > @Brandon: I tried running sudo strace , but I got the > error: > > > > trace: test_ptrace_setoptions_followfork: PTRACE_TRACEME doesn't work: > Permission denied > > > > strace: test_ptrace_setoptions_followfork: unexpected exit status 1 > > > > > > Thanks Konstantine + Brandon! > > > > > > On Sat, Jan 10, 2015 at 4:28 AM, Konstantine Rybnikov > wrote: > >> > >> Also, just for making this super-clear to reproduce, I would advice to > express a problem as a Dockerfile that lets you reproduce the problem in a > one command. > >> > >> Thanks. > >> > >> On Sat, Jan 10, 2015 at 4:02 AM, Stephen Portanova > wrote: > >>> > >>> I'm having trouble running my Scotty binary on amazon web services... > >>> > >>> I'm using Ubuntu 15.04, this gist ( > https://gist.github.com/yantonov/10083524) to install the haskell > platform dependencies, and then I do a git pull to my repo and build my > binary. > >>> > >>> Everything compiles, but when I do ./cabal-sandbox/bin/app or > >>> > >>> ./dist/build/app/app, nothing happens. No error messages or anything - > the terminal just goes to the next line and hangs (on my Mac development > machine the server starts up fine and prints a startup message). > >>> > >>> Any ideas or experience with deploying Scotty / Haskell apps would be > really appreciated, thanks! > >>> > >>> > >>> - Stephen > >>> > >>> _______________________________________________ > >>> Haskell-Cafe mailing list > >>> Haskell-Cafe at haskell.org > >>> http://www.haskell.org/mailman/listinfo/haskell-cafe > >>> > >> > > > > > > > > -- > > Stephen Portanova > > (480) 495-2634 > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > > > -- > https://lambda.xyz > -- Stephen Portanova (480) 495-2634 -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Mon Jan 12 01:26:59 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 11 Jan 2015 20:26:59 -0500 Subject: [Haskell-cafe] Deploying Scotty App to AWS In-Reply-To: References: Message-ID: On Sun, Jan 11, 2015 at 7:55 PM, Stephen Portanova wrote: > Chris, thanks for the response! Is there anything I can do to test / work > around that theory? > See if the rng-tools or haveged packages are available. Both of these harvest additional entropy, and are invaluable for solving the entropy starvation issues with Linux in any virtual machine environment. If they're already installed and running, you might look for AWS-specific instructions for tuning to maximize harvested entropy. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From briand at aracnet.com Mon Jan 12 05:52:02 2015 From: briand at aracnet.com (briand at aracnet.com) Date: Sun, 11 Jan 2015 21:52:02 -0800 Subject: [Haskell-cafe] FLTK bindings near completion. Need community assistance ... In-Reply-To: References: Message-ID: <20150111215202.3ce57190@cedar.deldotd.com> On Sun, 11 Jan 2015 12:39:40 -0600 aditya siram wrote: > Hi all, > I've been working on bindings [1] to the FLTK GUI toolkit [2] and I've come > to the point where it's mostly complete but I could use some help from the > community before I put it up on Hackage. > What a great idea. Been a while since i used fltk, but when i did i found it to be quite nice to work with. hopefully i can help, at least a little... From briand at aracnet.com Mon Jan 12 06:00:40 2015 From: briand at aracnet.com (briand at aracnet.com) Date: Sun, 11 Jan 2015 22:00:40 -0800 Subject: [Haskell-cafe] why can it never go smoothly, language-c-0.4.7 edition Message-ID: <20150111220040.34612db4@cedar.deldotd.com> Hi, setup-Simple-Cabal-1.22.0.0-x86_64-linux-ghc-7.8.4: The program 'happy' is required but it could not be found. so i installed happy. then it wanted alex. which i was also able to install. and then language-c-0.4.7 successfully installed. I have seen this sort of thing many times across all sorts of different packages. So my question is : are these dependency bugs that should be reported to the package maintainer ? or is that certain packages can't be built as a dependency target for some reason ? Thanks, Brian From roma at ro-che.info Mon Jan 12 09:08:37 2015 From: roma at ro-che.info (Roman Cheplyaka) Date: Mon, 12 Jan 2015 11:08:37 +0200 Subject: [Haskell-cafe] why can it never go smoothly, language-c-0.4.7 edition In-Reply-To: <20150111220040.34612db4@cedar.deldotd.com> References: <20150111220040.34612db4@cedar.deldotd.com> Message-ID: <54B38F15.9030701@ro-che.info> See https://github.com/haskell/cabal/issues/220 On 12/01/15 08:00, briand at aracnet.com wrote: > Hi, > > setup-Simple-Cabal-1.22.0.0-x86_64-linux-ghc-7.8.4: The program 'happy' is > required but it could not be found. > > so i installed happy. > > then it wanted alex. > > which i was also able to install. > > and then language-c-0.4.7 successfully installed. > > I have seen this sort of thing many times across all sorts of different packages. > > So my question is : are these dependency bugs that should be reported to the package maintainer ? > > or is that certain packages can't be built as a dependency target for some reason ? > > Thanks, > > > Brian > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From fabian.bergmark at gmail.com Mon Jan 12 13:01:43 2015 From: fabian.bergmark at gmail.com (Fabian Bergmark) Date: Mon, 12 Jan 2015 14:01:43 +0100 Subject: [Haskell-cafe] Typesafe API calls In-Reply-To: References: <54934022.4000604@gmx.us> Message-ID: I have noticed a steady increase in the number of downloads of the apis-0.0.1 package (now 67). However the number of downloads on the dependencies are far less (around 50%). Does this imply that people are having problem compiling the package? As the build process is a bit complex reports about this would be appreciated! Also, none of my packages can be found on hayoo, why is this? 2014-12-23 1:01 GMT+01:00 Fabian Bergmark : > I have uploaded a new version of the library > > https://hackage.haskell.org/package/apis-0.0.1 > > I'have included 15 more APIs from Facebook and Dropbox. I have also > uploaded documentation to Hackage. > > I have been working on creating an autotools installation script that > builds a makepkg package with the FFI bindings for Python and Java. I > have tried it on Arch and it seems to work. If you want to try it out, > check out the github repository. > > Building on top of this, Im working on a library that uses Pipes to > create producers (triggers) and consumers (actions), allowing one to > create effects (recipes) of the kind, when I am tagged in a photo on > Facebook, notify me via email. This very much resembles IFTTT but with > static and typesafe compositions. Im experimenting with using my > javascript interpreter to allow for more dynamic compositions. > > > 2014-12-18 21:59 GMT+01:00 Jonathan Paugh : >> Hello Fabian, >> >> I have been dreaming of something like this for Haskell since I wrote a >> (non type-safe) python library to access any REST API generically[1]. >> This comes from a different (and more ambitious) angle than I had imagined. >> >> I don't have time to test this just now, but I will keep it bookmarked. >> Thanks for sharing your hard work! >> >> Regards, >> Jonathan >> >> [1]: http://github.com/jpaugh/agithub (unmaintained, but maybe interesting) >> >> On 12/12/2014 07:01 AM, Fabian Bergmark wrote:> I just released a >> library on hackage >>> (https://hackage.haskell.org/package/apis-0.0.0). The goal of the >>> library is to provide typesafe API calls to a large amount of existing >>> APIs. By typesafe I mean that, for each API the library provides two >>> types, Input and Output, and a function :: Input -> IO Output. >>> Internally the library knows how to serialize Input to make an HTTP >>> request and how to deserialize the response into Output. >>> >>> Whats cool about this library is that it uses Template Haskell to >>> generate the API interfaces. A combination of Open Data Tables, an >>> internal YQL engine and JSON Schemas, all written in Haskell makes >>> this possible. >>> >>> Right now only two APIs are included (Swedish weather data and Swedish >>> public announcement), but more APIs are soon to follow. >>> >>> I have also implemented FFI exports of all types and functions so >>> that, in combination with SWIG, this library can be used in almost any >>> language. So far I have tried Java and Python with success. >>> >>> If anyone would like to try it and respond with feedback it would be >>> greatly appreciated! If you want any specific API supported, I can try >>> to import that right away >>> >>> Fabian Bergmark >>> >> From eir at cis.upenn.edu Mon Jan 12 16:27:24 2015 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Mon, 12 Jan 2015 11:27:24 -0500 Subject: [Haskell-cafe] May I have some examples on Kinds and Data.Type.Equality? In-Reply-To: References: Message-ID: <0676B595-FA56-43F7-AF6B-99CE4A633158@cis.upenn.edu> You can check out my examples from a talk I gave to the New York Haskell Users' Group, available at https://github.com/goldfirere/nyc-hug-oct2014 The TyRep example may be the best for what you're looking for... I hope this is helpful! Richard On Jan 6, 2015, at 2:38 AM, Magicloud Magiclouds wrote: > Hi, > > I am trying to learn some advanced stuff of Haskell. But haskell wiki seems only giving some concepts and so. > > May I have some code example? Also other documents are welcomed. > > Thanks. > > -- > ??????? > ??????? > > And for G+, please use magiclouds#gmail.com. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From conal at conal.net Mon Jan 12 20:01:08 2015 From: conal at conal.net (Conal Elliott) Date: Mon, 12 Jan 2015 12:01:08 -0800 Subject: [Haskell-cafe] FLTK bindings near completion. Need community assistance ... In-Reply-To: References: Message-ID: Hi Deech. I build fltk and fltkhs on my MacBook Pro with Mac OS 10.9.5. Everything went smoothly, and the examples run fine. -- Conal On Sun, Jan 11, 2015 at 10:39 AM, aditya siram wrote: > Hi all, > I've been working on bindings [1] to the FLTK GUI toolkit [2] and I've > come to the point where it's mostly complete but I could use some help from > the community before I put it up on Hackage. > > My hope is to eventually fill the need in the Haskell ecosystem for a > native GUI library that: > - runs on all platforms > - is easily installable > - is small and fast > - has a minimum of dependencies. Currently this library uses only base, > stm, bytestring and c2hs. > - is conservative with extensions. Currently the most recent extension > required is GADTs. > > If any of this sounds good to you, I could use some help with: > - testing the build on Linux and OSX. This should be as simple as > installing FLTK, cloning the repo [1] and running `cabal build`. Better > instructions are in included README. > - getting it to build on Windows. I unfortunately don't have access to a > Windows machine. > - getting it to build on older GHC's. I used 7.8.3 because that is what I > have, but it should work back to the first version of GHC that introduced > GADTs. Unfortunately the included `Setup.hs` is non-trivial and I been > having trouble getting it work with versions of Cabal older than 1.20 due > to breaking API changes across versions. > - building a single library. Currently the C/C++ wrappers and Haskell > bindings are two separate statically linked libraries. They are copied to > the same location so applications built with this package don't have to > know that, but it would be ideal if it was all-in-one. > - building a shared library on Mac OSX. > > Any other feedback you have is totally welcome. > > Thanks! > -deech > > [1] https://github.com/deech/fltkhs > [2] http://www.fltk.org/index.php > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From J.T.Jeuring at uu.nl Tue Jan 13 09:26:29 2015 From: J.T.Jeuring at uu.nl (Johan Jeuring) Date: Tue, 13 Jan 2015 10:26:29 +0100 Subject: [Haskell-cafe] Vacancies: 4 PhD students Software Technology Utrecht University Message-ID: ============================================================ 4 x PhD position in Software Technology ============================================================ The research group of Software Technology is part of the Software Systems division of in the department of Information and Computer Science at the Utrecht University. We focus our research on functional programming, compiler construction, program analysis, validation, and verification. Financed by the Netherlands Organisation for Scientific Research (NWO), the EU, Technology Foundation STW and Utrecht University we currently have job openings for four PhD researchers (PhD students) in Software Technology. We are looking for PhD students to work on some of the following topics: * Version control of structured data The theory and practice underlying structure-aware version control systems capable of handling more than just text files. * Intelligent tutoring technologies Technologies for tutoring subjects such as functional programming, statistics, algebra, etc. * Serious games Domain-specific languages and technologies for specifying strategies for serious games. * iTasks iTasks is a formalism for specifying distributed tasks. Specify and test properties of iTasks, and give run-time feedback for iTasks. Besides research, the successful candidate will be expected to help supervise MSc students and assist teaching courses. We prefer candidates to start no later than September 2015. --------------------------- What we are looking for --------------------------- The candidate should have an MSc in Computer Science, be highly motivated, speak and write English well. Furthermore the successful candidate should be proficient in reporting scientific findings. Knowledge of and experience with at least some of the following areas (depending on the topic chosen to work on for your PhD) is essential: * functional programming, such as Haskell or ML; * datatype generic programming; * intelligent tutoring systems; * serious games; * strategies, rewriting, parsing; * modern version control systems such as git, mercurial, or darcs. ------------------ What we offer ------------------ The candidate is offered a full-time position for 4 years. A part-time position of at least 0.8 fte may also be possible. Salary starts at 2083 euro and increases to 2664 euro gross per month in the fourth year of the appointment. The salary is supplemented with a holiday bonus of 8% and an end-of-year bonus of 8.3% per year. In addition we offer: a pension scheme, partially paid parental leave, flexible employment conditions. Conditions are based on the Collective Labour Agreement Dutch Universities. The research group will provide the candidate with necessary support on all aspects of the project. ---------------- How to apply ---------------- To apply please attach a letter of motivation, a curriculum vitae, and (email) addresses of two referees. Make sure to also include a transcript of the courses you have followed (at bachelor and master level), with the grades you obtained, and to include a sample of your scientific writing, such as your master thesis. It is possible to apply for this position if you are close to obtaining your Master's. In that case include a letter of your supervisor with an estimate of your progress, and do not forget to include at least a sample of your technical writing skills. Application deadline is March 8, 2015. You can apply online through the University's website: http://tinyurl.com/qhlco6s --------------------------- Additional information --------------------------- If you have any questions regarding these positions, please contact Johan Jeuring +31 (0)640010053 J.T.Jeuring at uu.nl Wouter Swierstra +31 (0)30 253 9207 w.s.swierstra at uu.nl From marco.vax91 at gmail.com Tue Jan 13 10:57:22 2015 From: marco.vax91 at gmail.com (Marco Vassena) Date: Tue, 13 Jan 2015 11:57:22 +0100 Subject: [Haskell-cafe] uu-parsinglib - Greedy Parser Message-ID: In the uu-parsinglib the choice combinator (<|>) is symmetric and does not commit to any alternative. If the grammar being parsed is ambiguous, the corresponding parser will fail at run time on an ambiguous input. Consider for instance this html parser. pTag = pOpenTag <|> pCloseTag <|> pCommentTag <|> pContent pContent = Content <$> some (satisfy (/= '<')) pHtml = some pTag This parser will fail on "123", because this may be interpreted as: [ [Open a , Content "123", Close a], [Open a, Content "12", Content "3", Close a], [Open a, Content "1", Content "2", Content "3", Close a] ... ] In other parsing libraries such as parsec the choice operator <|> is greedy and commits to the first alternative that makes any progress, so that some is greedy and Content "123" would be parsed. The operator <<|> in uu-parsinglib has the same greedy behaviour. I would like to disambiguate the grammar so that the first result ([Open a, Content "123", Close a]) is selected (longest matching rule). I suppose that this may be done using <<|> to define a greedySome to be used in in pContent, however I am wondering whether there is another way to do this, without using such operator <<|>. Any help is appreciated. All the best, Marco From simons at cryp.to Tue Jan 13 11:20:13 2015 From: simons at cryp.to (Peter Simons) Date: Tue, 13 Jan 2015 12:20:13 +0100 Subject: [Haskell-cafe] uu-parsinglib - Greedy Parser References: Message-ID: <871tmzorki.fsf@write-only.cryp.to> Hi Marco, > I suppose that this may be done using <<|> to define a greedySome to be > used in in pContent, however I am wondering whether > there is another way to do this, without using such operator <<|>. the 'micro' function attaches a cost a branch of the parse tree, and the library generally prefers the branch with the lowest cost. Maybe this is what you're looking for? Best regards, Peter From doaitse at swierstra.net Tue Jan 13 11:22:27 2015 From: doaitse at swierstra.net (S. Doaitse Swierstra) Date: Tue, 13 Jan 2015 12:22:27 +0100 Subject: [Haskell-cafe] uu-parsinglib - Greedy Parser In-Reply-To: References: Message-ID: <78014D03-BD59-486C-AEEC-99618D2C3C98@swierstra.net> > On 13 Jan 2015, at 11:57 , Marco Vassena wrote: > > In the uu-parsinglib the choice combinator (<|>) is symmetric and does not commit to any alternative. > If the grammar being parsed is ambiguous, the corresponding parser will fail at run time on an ambiguous input. > > Consider for instance this html parser. > > pTag = pOpenTag <|> pCloseTag <|> pCommentTag <|> pContent > > pContent = Content <$> some (satisfy (/= '<')) > pHtml = some pTag > > This parser will fail on "123", because this may be interpreted as: > [ [Open a , Content "123", Close a], > [Open a, Content "12", Content "3", Close a], > [Open a, Content "1", Content "2", Content "3", Close a] ... ] > > In other parsing libraries such as parsec the choice operator <|> is greedy and commits to the first alternative that makes > any progress, so that some is greedy and Content "123" would be parsed. > The operator <<|> in uu-parsinglib has the same greedy behaviour. > > I would like to disambiguate the grammar so that the first result ([Open a, Content "123", Close a]) is selected (longest matching rule). > I suppose that this may be done using <<|> to define a greedySome to be used in in pContent, however I am wondering whether > there is another way to do this, without using such operator <<|>. The thing to do it to use the pList combinator which is greedy (the pList_ng counterpart is non-greedy): pContent = Content <$> pList (satisfy (/= '<')) An even better approach would be to reflect the structure of your HTML in your parser: pContent = tag_semantics <$> pOpenTag <*> pContent <* pCloseTag In case you re sure about the correctness of your HTML you might want to enforce, by using a monadic construct to check for the closing tag to correspons to the opening tag (note that I am in general not in favour of using monads, since they make the abstrcat interpretation going on expensive): pTagged = do t <- pOpentag c <- pContents pClosetag t return (Tagged t c) (of course with appropriate definitions for pOpentag and pCloseTag. Finally the module BasicInstances contains a combinator pMunch which you could have used: pContent = Content <$> pMunch (/= '<') This is far more efficient since it operates directly at the state. Doaitse > > Any help is appreciated. > > All the best, > Marco > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From ozgurakgun at gmail.com Tue Jan 13 12:28:22 2015 From: ozgurakgun at gmail.com (Ozgur Akgun) Date: Tue, 13 Jan 2015 12:28:22 +0000 Subject: [Haskell-cafe] --disable-{executable-}profiling cabal-install-1.22.0.0 with ghc-7.6.3 Message-ID: A recent change in cabal-install's command line interface seems not to be compatible with ghc-7.6.3. cabal-install-1.22.0.0 doesn't like --disable-executable-profiling as a command line option any more. (I could only find this related to this change: https://github.com/haskell/cabal/pull/2286) $ cabal install --disable-executable-profiling cabal: unrecognized 'install' option `--disable-executable-profiling' I try --disable-profiling instead. $ cabal install transformers --disable-profiling -j3 Resolving dependencies... Notice: installing into a sandbox located at [snip] Configuring transformers-0.4.2.0... Failed to install transformers-0.4.2.0 Build log [snip]: unrecognized 'configure' option `--disable-profiling' cabal: Error: some packages failed to install: transformers-0.4.2.0 failed during the configure step. The exception was: ExitFailure 1 Using the following versions of cabal and ghc. $ cabal -V cabal-install version 1.22.0.0 using version 1.22.0.0 of the Cabal library $ ghc -V The Glorious Glasgow Haskell Compilation System, version 7.6.3 --disable-profiling works fine with ghc-7.8.3, this is only a problem with 7.6.3. PS: transformers is only a dependency of an executable I am trying to build. But this happens with all the other dependencies as well. -- Ozgur Akgun -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicholls.mark at vimn.com Tue Jan 13 12:39:23 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Tue, 13 Jan 2015 12:39:23 +0000 Subject: [Haskell-cafe] working my way through Data.Type.Equality...my head hurts... Message-ID: Full code here? https://github.com/goldfirere/nyc-hug-oct2014/blob/master/Equality.hs Lets start at the beginning? ? data a :~: b where ? Refl :: a :~: a Looks reasonable?.? a :~: b? is inhabited by 1 value?of type ?a :~: a? ? sym :: (a :~: b) -> (b :~: a) ? sym Refl = Refl hmmm? (a :~: b) implies that a is b so (b :~: a) brilliant ? -- | Transitivity of equality ? trans :: (a :~: b) -> (b :~: c) -> (a :~: c) ? trans Refl Refl = Refl ? -- | Type-safe cast, using propositional equality ? castWith :: (a :~: b) -> a -> b ? castWith Refl x = x fine?. But?. ? -- | Generalized form of type-safe cast using propositional equality ? gcastWith :: (a :~: b) -> ((a ~ b) => r) -> r ? gcastWith Refl x = x I don?t even understand the signature What does ?~? mean?(it?s something that comes out in error messages when my types are all messed up)?.and then there?s a ?=>? going on?in the middle of a signature?.I know ?=>? in the context of ?Num a => a -> a -> a? What would a value of type ?((a ~ b) => r)? look like? CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ollie at ocharles.org.uk Tue Jan 13 12:51:30 2015 From: ollie at ocharles.org.uk (Oliver Charles) Date: Tue, 13 Jan 2015 12:51:30 +0000 Subject: [Haskell-cafe] working my way through Data.Type.Equality...my head hurts... In-Reply-To: References: Message-ID: On Tue, Jan 13, 2015 at 12:39 PM, Nicholls, Mark wrote: > But?. > > > > ? -- | Generalized form of type-safe cast using propositional equality > > ? gcastWith :: (a :~: b) -> ((a ~ b) => r) -> r > > ? gcastWith Refl x = x > > > > I don?t even understand the signature > > > > What does ?~? mean?(it?s something that comes out in error messages when > my types are all messed up)?.and then there?s a ?=>? going on?in the middle > of a signature?.I know ?=>? in the context of ?Num a => a -> a -> a? > a ~ b is a constraint that a and b are exactly the same type. For example, Int ~ Int is satisfiable, but Int ~ Bool is not. So what gcastWith does is take a witness that a and b are the same type (witnessed by the a :~: b value), and then lets you form a value using that evidence. What would a value of type ?((a ~ b) => r)? look like? > > I can't come up with a workable example right now, but I could imagine that you might have: reverseReverse :: a :~: (Reverse (Reverse a)) Then if you have something that needs to work on a Reverse (Reverse a) value, but you only have a 'a' around, you can show GHC that it doesn't matter - because they are the same type: gcastWith reverseReverse :: (a ~ Reverse (Reverse a) => r) -> r Presumably whatever 'r' is will refer to 'a' and do something with it (maybe mapping over a list or something). Sorry that this is all fairly vague, but hopefully that gives you some leads. -- ocharles -------------- next part -------------- An HTML attachment was scrubbed... URL: From hesselink at gmail.com Tue Jan 13 13:00:43 2015 From: hesselink at gmail.com (Erik Hesselink) Date: Tue, 13 Jan 2015 14:00:43 +0100 Subject: [Haskell-cafe] --disable-{executable-}profiling cabal-install-1.22.0.0 with ghc-7.6.3 In-Reply-To: References: Message-ID: I've had this problem as well. I think the issue is that 'cabal' now expects '--disable-profiling', but if you have a custom Setup.hs, it can be compiled with an older version of the Cabal library, and then it expects '--disable-executable-profiling' again. What is the output of 'ghc-pkg list Cabal'? I meant to report this issue as well, so thank you for bringing it up. There's a similar issue for --disable[-library]-coverage. It's not only this issue that is annoying about it, but also that it makes it very hard to write wrapper scripts around cabal that use these flags. Cabal devs, do you think the old flags could be added back, perhaps with a deprecation warning or something? Regards, Erik On Tue, Jan 13, 2015 at 1:28 PM, Ozgur Akgun wrote: > A recent change in cabal-install's command line interface seems not to be > compatible with ghc-7.6.3. > > cabal-install-1.22.0.0 doesn't like --disable-executable-profiling as a > command line option any more. (I could only find this related to this > change: https://github.com/haskell/cabal/pull/2286) > > $ cabal install --disable-executable-profiling > cabal: unrecognized 'install' option `--disable-executable-profiling' > > I try --disable-profiling instead. > > $ cabal install transformers --disable-profiling -j3 > Resolving dependencies... > Notice: installing into a sandbox located at [snip] > Configuring transformers-0.4.2.0... > Failed to install transformers-0.4.2.0 > Build log [snip]: > unrecognized 'configure' option `--disable-profiling' > cabal: Error: some packages failed to install: > transformers-0.4.2.0 failed during the configure step. The exception was: > ExitFailure 1 > > Using the following versions of cabal and ghc. > > $ cabal -V > cabal-install version 1.22.0.0 > using version 1.22.0.0 of the Cabal library > $ ghc -V > The Glorious Glasgow Haskell Compilation System, version 7.6.3 > > --disable-profiling works fine with ghc-7.8.3, this is only a problem with > 7.6.3. > > > PS: transformers is only a dependency of an executable I am trying to build. > But this happens with all the other dependencies as well. > > > > -- > Ozgur Akgun > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From ozgurakgun at gmail.com Tue Jan 13 13:13:56 2015 From: ozgurakgun at gmail.com (Ozgur Akgun) Date: Tue, 13 Jan 2015 13:13:56 +0000 Subject: [Haskell-cafe] --disable-{executable-}profiling cabal-install-1.22.0.0 with ghc-7.6.3 In-Reply-To: References: Message-ID: On 13 January 2015 at 13:00, Erik Hesselink wrote: > I've had this problem as well. I think the issue is that 'cabal' now > expects '--disable-profiling', but if you have a custom Setup.hs, it > can be compiled with an older version of the Cabal library, and then > it expects '--disable-executable-profiling' again. What is the output > of 'ghc-pkg list Cabal'? > I have 3 versions of Cabal as reported by "ghc-pkg list Cabal". Cabal-1.16.0 in the global package db, Cabal-1.18.1 and Cabal-1.20.0.0 in the user db. Do you think I should be hiding the old ones? Ozgur -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.stolarek at p.lodz.pl Tue Jan 13 13:13:24 2015 From: jan.stolarek at p.lodz.pl (Jan Stolarek) Date: Tue, 13 Jan 2015 14:13:24 +0100 Subject: [Haskell-cafe] working my way through Data.Type.Equality...my head hurts... In-Reply-To: References: Message-ID: <201501131413.24107.jan.stolarek@p.lodz.pl> > What does ?~? mean?(it?s something that comes out in error messages when my > types are all messed up)?. It means GHC knows that two types are equal. > and then there?s a ?=>? going on?in the middle of > a signature?.I know ?=>? in the context of ?Num a => a -> a -> a? Yeah, that looks scary. You use gcastWith when you need a value of type a but you have a value of type b with a proof that a and b are equal (here a proof is a value of a :~: b). I have a practical example, though perhaps it's not the simplest one: https://github.com/jstolarek/dep-typed-wbl-heaps-hs/blob/master/src/TwoPassMerge/RankProof.hs#L361 This code is thought as an intermediate level tutorial - you might want to give it a try. Another example I have is here (I use the name subst, but it's identical to gcastWith): https://github.com/jstolarek/why-dependent-types-matter/blob/master/WhyDependentTypesMatter.hs#L220 HTH Janek From nicholls.mark at vimn.com Tue Jan 13 13:14:43 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Tue, 13 Jan 2015 13:14:43 +0000 Subject: [Haskell-cafe] working my way through Data.Type.Equality...my head hurts... In-Reply-To: References: Message-ID: It is fairly vague?I think it gets me to understand in a hand wavy sort of way. Let me look a little deeper. On Tue, Jan 13, 2015 at 12:39 PM, Nicholls, Mark > wrote: But?. > -- | Generalized form of type-safe cast using propositional equality > gcastWith :: (a :~: b) -> ((a ~ b) => r) -> r > gcastWith Refl x = x I don?t even understand the signature What does ?~? mean?(it?s something that comes out in error messages when my types are all messed up)?.and then there?s a ?=>? going on?in the middle of a signature?.I know ?=>? in the context of ?Num a => a -> a -> a? a ~ b is a constraint that a and b are exactly the same type. For example, Int ~ Int is satisfiable, but Int ~ Bool is not. So what gcastWith does is take a witness that a and b are the same type (witnessed by the a :~: b value), and then lets you form a value using that evidence. What would a value of type ?((a ~ b) => r)? look like? I can't come up with a workable example right now, but I could imagine that you might have: reverseReverse :: a :~: (Reverse (Reverse a)) Then if you have something that needs to work on a Reverse (Reverse a) value, but you only have a 'a' around, you can show GHC that it doesn't matter - because they are the same type: gcastWith reverseReverse :: (a ~ Reverse (Reverse a) => r) -> r Presumably whatever 'r' is will refer to 'a' and do something with it (maybe mapping over a list or something). Sorry that this is all fairly vague, but hopefully that gives you some leads. -- ocharles CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. -------------- next part -------------- An HTML attachment was scrubbed... URL: From johan.tibell at gmail.com Tue Jan 13 13:20:04 2015 From: johan.tibell at gmail.com (Johan Tibell) Date: Tue, 13 Jan 2015 05:20:04 -0800 Subject: [Haskell-cafe] --disable-{executable-}profiling cabal-install-1.22.0.0 with ghc-7.6.3 In-Reply-To: References: Message-ID: Already fixed on the 1.22 branch: https://github.com/haskell/cabal/issues/2313 On Tue, Jan 13, 2015 at 5:13 AM, Ozgur Akgun wrote: > > On 13 January 2015 at 13:00, Erik Hesselink wrote: > >> I've had this problem as well. I think the issue is that 'cabal' now >> expects '--disable-profiling', but if you have a custom Setup.hs, it >> can be compiled with an older version of the Cabal library, and then >> it expects '--disable-executable-profiling' again. What is the output >> of 'ghc-pkg list Cabal'? >> > > I have 3 versions of Cabal as reported by "ghc-pkg list Cabal". > Cabal-1.16.0 in the global package db, Cabal-1.18.1 and Cabal-1.20.0.0 in > the user db. > Do you think I should be hiding the old ones? > > Ozgur > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hesselink at gmail.com Tue Jan 13 13:20:08 2015 From: hesselink at gmail.com (Erik Hesselink) Date: Tue, 13 Jan 2015 14:20:08 +0100 Subject: [Haskell-cafe] --disable-{executable-}profiling cabal-install-1.22.0.0 with ghc-7.6.3 In-Reply-To: References: Message-ID: On Tue, Jan 13, 2015 at 2:13 PM, Ozgur Akgun wrote: > > On 13 January 2015 at 13:00, Erik Hesselink wrote: >> >> I've had this problem as well. I think the issue is that 'cabal' now >> expects '--disable-profiling', but if you have a custom Setup.hs, it >> can be compiled with an older version of the Cabal library, and then >> it expects '--disable-executable-profiling' again. What is the output >> of 'ghc-pkg list Cabal'? > > I have 3 versions of Cabal as reported by "ghc-pkg list Cabal". > Cabal-1.16.0 in the global package db, Cabal-1.18.1 and Cabal-1.20.0.0 in > the user db. > Do you think I should be hiding the old ones? I think you need to install Cabal-1.22 at least, if you want cabal-install 1.22 to work with these flags. That's my suspicion, at least, I haven't thoroughly tested this. If you have 1.22, I think cabal-install will just use that, since it's the newest. If it doesn't, you can try hiding the older ones. Erik From nicholls.mark at vimn.com Tue Jan 13 13:21:49 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Tue, 13 Jan 2015 13:21:49 +0000 Subject: [Haskell-cafe] working my way through Data.Type.Equality...my head hurts... In-Reply-To: <201501131413.24107.jan.stolarek@p.lodz.pl> References: <201501131413.24107.jan.stolarek@p.lodz.pl> Message-ID: brilliant the 1st link is a bit challenging...the 2nd I can probably cope with for the moment, though I may be asking questions. If you have any beginner level tutorial, then that?s even better..I can just about cope with associated types, type families and GADT...some of the other extensions I suspect disbelief for. > What does ?~? mean?(it?s something that comes out in error messages > when my types are all messed up)?. It means GHC knows that two types are equal. > and then there?s a ?=>? going on?in the middle of a signature?.I know > ?=>? in the context of ?Num a => a -> a -> a? Yeah, that looks scary. You use gcastWith when you need a value of type a but you have a value of type b with a proof that a and b are equal (here a proof is a value of a :~: b). I have a practical example, though perhaps it's not the simplest one: https://github.com/jstolarek/dep-typed-wbl-heaps-hs/blob/master/src/TwoPassMerge/RankProof.hs#L361 This code is thought as an intermediate level tutorial - you might want to give it a try. Another example I have is here (I use the name subst, but it's identical to gcastWith): https://github.com/jstolarek/why-dependent-types-matter/blob/master/WhyDependentTypesMatter.hs#L220 HTH Janek CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. From marco.vax91 at gmail.com Tue Jan 13 13:25:48 2015 From: marco.vax91 at gmail.com (Marco Vassena) Date: Tue, 13 Jan 2015 14:25:48 +0100 Subject: [Haskell-cafe] uu-parsinglib - Greedy Parser In-Reply-To: <78014D03-BD59-486C-AEEC-99618D2C3C98@swierstra.net> References: <78014D03-BD59-486C-AEEC-99618D2C3C98@swierstra.net> Message-ID: > The thing to do it to use the pList combinator which is greedy (the pList_ng counterpart is non-greedy): > > pContent = Content <$> pList (satisfy (/= '<')) Checking the source code pList is defined in terms of pFoldr, which uses opt, which eventually is defined in terms of <<|>. > An even better approach would be to reflect the structure of your HTML in your parser: > > pContent = tag_semantics <$> pOpenTag <*> pContent <* pCloseTag > In case you re sure about the correctness of your HTML you might want to enforce, by using a monadic construct to check for the closing tag to correspons to the opening tag (note that I am in general not in favour of using monads, since they make the abstrcat interpretation going on expensive): > > pTagged = do t <- pOpentag > c <- pContents > pClosetag t > return (Tagged t c) > > (of course with appropriate definitions for pOpentag and pCloseTag. Unfortunately in html there are also empty tags, which don't need to be closed. For instance the line-break tag
:

Line break tags are
not closed

The bigger picture is that I am trying to figure out what are the core constructs needed to define a parser, therefore I want to have a rather abstract interface. In my set of core constructs there are: <$> : (a -> b) -> f a -> f b <*> : f (a -> b) -> f a -> f b <|> : f a -> f a -> f a -- (symmetric choice) pure : a -> f a fail : f a pToken : f Char Is it possible to define a parser that applies the longest matching rule using these constructs only? Or is it necessary to extend it with another primitive, for instance greedy choice <<|> ? (Note that f is abstract and it is not necessarily uu-parsinglib parsers). Marco On 13/gen/2015, at 12.22, S. Doaitse Swierstra wrote: > >> On 13 Jan 2015, at 11:57 , Marco Vassena wrote: >> >> In the uu-parsinglib the choice combinator (<|>) is symmetric and does not commit to any alternative. >> If the grammar being parsed is ambiguous, the corresponding parser will fail at run time on an ambiguous input. >> >> Consider for instance this html parser. >> >> pTag = pOpenTag <|> pCloseTag <|> pCommentTag <|> pContent >> >> pContent = Content <$> some (satisfy (/= '<')) >> pHtml = some pTag >> >> This parser will fail on "123", because this may be interpreted as: >> [ [Open a , Content "123", Close a], >> [Open a, Content "12", Content "3", Close a], >> [Open a, Content "1", Content "2", Content "3", Close a] ... ] >> >> In other parsing libraries such as parsec the choice operator <|> is greedy and commits to the first alternative that makes >> any progress, so that some is greedy and Content "123" would be parsed. >> The operator <<|> in uu-parsinglib has the same greedy behaviour. >> >> I would like to disambiguate the grammar so that the first result ([Open a, Content "123", Close a]) is selected (longest matching rule). >> I suppose that this may be done using <<|> to define a greedySome to be used in in pContent, however I am wondering whether >> there is another way to do this, without using such operator <<|>. > > The thing to do it to use the pList combinator which is greedy (the pList_ng counterpart is non-greedy): > > pContent = Content <$> pList (satisfy (/= '<')) > > An even better approach would be to reflect the structure of your HTML in your parser: > > pContent = tag_semantics <$> pOpenTag <*> pContent <* pCloseTag > > In case you re sure about the correctness of your HTML you might want to enforce, by using a monadic construct to check for the closing tag to correspons to the opening tag (note that I am in general not in favour of using monads, since they make the abstrcat interpretation going on expensive): > > pTagged = do t <- pOpentag > c <- pContents > pClosetag t > return (Tagged t c) > > (of course with appropriate definitions for pOpentag and pCloseTag. > > Finally the module BasicInstances contains a combinator pMunch which you could have used: > > pContent = Content <$> pMunch (/= '<') > > This is far more efficient since it operates directly at the state. > > Doaitse > > > > >> >> Any help is appreciated. >> >> All the best, >> Marco >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > From mblazevic at stilo.com Tue Jan 13 13:30:03 2015 From: mblazevic at stilo.com (Mario Blazevic) Date: Tue, 13 Jan 2015 08:30:03 -0500 Subject: [Haskell-cafe] ANNOUNCE: picoparsec-0.1 Message-ID: The newly released package picoparsec [1] is a fork of attoparsec that works with a much wider variety of input types than just ByteString and Text. Parsers written with Picoparsec will generally perform a bit slower than Attoparsec on strict ByteString and Text, somewhat faster than Attoparsec on lazy Text, and much faster than Parsec on any of the mutually-supported input types. That being said, the main point of the library is to enable the writing of generic parsers that are not constrained to any single input type. Depending on the parser primitives used, Picoparsec will take any input whose type is an instance of either NullMonoid, LeftGCDMonoid, FactorialMonoid, or TextualMonoid. These are some of the subclasses of Monoid defined in the monoid-subclasses package [2]. Some of the input types that are fully supported out of the box would be: - Text - String - Seq Char - Vector Char - ByteStringUTF8, a thin newtype wrapper around ByteString - Stateful (Map String a) Text, if you need to parse Text and keep track of the the symbol table state - OffsetPositioned String, in case you need to keep track of the current input position - LinePositioned Text, to keep track of the current line and column This release can be seen as the belated completion of the work described in my Haskell Symposium 2013 presentation [3]. The name Picoparsec seemed to fit in just the right place between Parsec and Attoparsec, especially since Nanoparsec [4] has already been taken. [1] http://hackage.haskell.org/package/picoparsec [2] http://hackage.haskell.org/package/monoid-subclasses [3] https://github.com/blamario/monoid-subclasses/wiki/Files/HaskellSymposium2013.pdf [4] http://hackage.haskell.org/package/nanoparsec -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.stolarek at p.lodz.pl Tue Jan 13 13:33:25 2015 From: jan.stolarek at p.lodz.pl (Jan Stolarek) Date: Tue, 13 Jan 2015 14:33:25 +0100 Subject: [Haskell-cafe] working my way through Data.Type.Equality...my head hurts... In-Reply-To: References: <201501131413.24107.jan.stolarek@p.lodz.pl> Message-ID: <201501131433.25479.jan.stolarek@p.lodz.pl> > the 1st link is a bit challenging... You may want to read 3rd chapter of Okasaki's "Purely Functional Data Structures" - it describes weight-biased lefitsh heaps without any type-level magic. > the 2nd I can probably cope with for the moment, though I may be asking questions. As you probably noticed this is based on paper "Why Dependent Types Matter", so you should probably read the paper and follow the code. > If you have any beginner level tutorial, then that?s even better.. I personally learned all these things in Agda. It's a bit easier because it's a fully-fledged dependently-typed language and things are just easier to write. Only then I moved to Haskell. Janek > I can > just about cope with associated types, type families and GADT...some of the > other extensions I suspect disbelief for. > > > What does ?~? mean?(it?s something that comes out in error messages > > when my types are all messed up)?. > > It means GHC knows that two types are equal. > > > and then there?s a ?=>? going on?in the middle of a signature?.I know > > ?=>? in the context of ?Num a => a -> a -> a? > > Yeah, that looks scary. You use gcastWith when you need a value of type a > but you have a value of type b with a proof that a and b are equal (here a > proof is a value of a :~: b). I have a practical example, though perhaps > it's not the simplest one: > > https://github.com/jstolarek/dep-typed-wbl-heaps-hs/blob/master/src/TwoPass >Merge/RankProof.hs#L361 > > This code is thought as an intermediate level tutorial - you might want to > give it a try. Another example I have is here (I use the name subst, but > it's identical to gcastWith): > > https://github.com/jstolarek/why-dependent-types-matter/blob/master/WhyDepe >ndentTypesMatter.hs#L220 > > HTH > > Janek > > CONFIDENTIALITY NOTICE > > This e-mail (and any attached files) is confidential and protected by > copyright (and other intellectual property rights). If you are not the > intended recipient please e-mail the sender and then delete the email and > any attached files immediately. Any further use or dissemination is > prohibited. > > While MTV Networks Europe has taken steps to ensure that this email and any > attachments are virus free, it is your responsibility to ensure that this > message and any attachments are virus free and do not affect your systems / > data. > > Communicating by email is not 100% secure and carries risks such as delay, > data corruption, non-delivery, wrongful interception and unauthorised > amendment. If you communicate with us by e-mail, you acknowledge and assume > these risks, and you agree to take appropriate measures to minimise these > risks when e-mailing us. > > MTV Networks International, MTV Networks UK & Ireland, Greenhouse, > Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions > International, Be Viacom, Viacom International Media Networks and VIMN and > Comedy Central are all trading names of MTV Networks Europe. MTV Networks > Europe is a partnership between MTV Networks Europe Inc. and Viacom > Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley > Crescent, London, NW1 8TT. From ozgurakgun at gmail.com Tue Jan 13 13:42:04 2015 From: ozgurakgun at gmail.com (Ozgur Akgun) Date: Tue, 13 Jan 2015 13:42:04 +0000 Subject: [Haskell-cafe] --disable-{executable-}profiling cabal-install-1.22.0.0 with ghc-7.6.3 In-Reply-To: References: Message-ID: On 13 January 2015 at 13:20, Johan Tibell wrote: > Already fixed on the 1.22 branch: > https://github.com/haskell/cabal/issues/2313 > Great, thanks! The fix seems to be allowing the use of the old flag (--disable-executable-profiling). Using the new flag (--disable-profiling) with an older ghc also apparently works, but requires Cabal-1.22.0.0 (as well as cabal-install-1.22.0.0) So I wonder: why doesn't cabal-install-1.22.0.0 require Cabal-1.22.0.0? Ozgur > > On Tue, Jan 13, 2015 at 5:13 AM, Ozgur Akgun wrote: > >> >> On 13 January 2015 at 13:00, Erik Hesselink wrote: >> >>> I've had this problem as well. I think the issue is that 'cabal' now >>> expects '--disable-profiling', but if you have a custom Setup.hs, it >>> can be compiled with an older version of the Cabal library, and then >>> it expects '--disable-executable-profiling' again. What is the output >>> of 'ghc-pkg list Cabal'? >>> >> >> I have 3 versions of Cabal as reported by "ghc-pkg list Cabal". >> Cabal-1.16.0 in the global package db, Cabal-1.18.1 and Cabal-1.20.0.0 in >> the user db. >> Do you think I should be hiding the old ones? >> >> Ozgur >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > -- Ozgur Akgun -------------- next part -------------- An HTML attachment was scrubbed... URL: From ozgurakgun at gmail.com Tue Jan 13 13:43:44 2015 From: ozgurakgun at gmail.com (Ozgur Akgun) Date: Tue, 13 Jan 2015 13:43:44 +0000 Subject: [Haskell-cafe] --disable-{executable-}profiling cabal-install-1.22.0.0 with ghc-7.6.3 In-Reply-To: References: Message-ID: Erik, On 13 January 2015 at 13:20, Erik Hesselink wrote: > I think you need to install Cabal-1.22 at least, if you want > cabal-install 1.22 to work with these flags. That's my suspicion, at > least, I haven't thoroughly tested this. If you have 1.22, I think > cabal-install will just use that, since it's the newest. If it > doesn't, you can try hiding the older ones. > I've just tried, and you suspicion is correct! Compiling cabal install with Cabal-1.22.0.0 enables the use of the new flag with the old ghc. To be precise, I ran the following and can use --disable-profiling with ghc-7.6.3 now. $ cabal install cabal-install-1.22.0.0 Cabal-1.22.0.0 Thanks! Ozgur -------------- next part -------------- An HTML attachment was scrubbed... URL: From ozgurakgun at gmail.com Tue Jan 13 13:53:45 2015 From: ozgurakgun at gmail.com (Ozgur Akgun) Date: Tue, 13 Jan 2015 13:53:45 +0000 Subject: [Haskell-cafe] --disable-{executable-}profiling cabal-install-1.22.0.0 with ghc-7.6.3 In-Reply-To: References: Message-ID: On 13 January 2015 at 13:43, Ozgur Akgun wrote: > To be precise, I ran the following and can use --disable-profiling with > ghc-7.6.3 now. > I spoke too early. Weird problem, running `cabal install --disable-profiling -j1` works, but using a higher number of cores I get the same error during cabal configure. Here is what I did. $ ghc -V The Glorious Glasgow Haskell Compilation System, version 7.6.3 $ cabal -V cabal-install version 1.22.0.0 using version 1.22.0.0 of the Cabal library $ cabal install -j3 --disable-profiling mtl Resolving dependencies... Configuring transformers-0.4.2.0... Failed to install transformers-0.4.2.0 Build log [...]: unrecognized 'configure' option `--disable-profiling' cabal: Error: some packages failed to install: mtl-2.2.1 depends on transformers-0.4.2.0 which failed to install. transformers-0.4.2.0 failed during the configure step. The exception was: ExitFailure 1 $ cabal install -j1 --disable-profiling mtl (This works fine.) Am I missing something? Ozgur -------------- next part -------------- An HTML attachment was scrubbed... URL: From doaitse at swierstra.net Tue Jan 13 13:56:25 2015 From: doaitse at swierstra.net (S. Doaitse Swierstra) Date: Tue, 13 Jan 2015 14:56:25 +0100 Subject: [Haskell-cafe] uu-parsinglib - Greedy Parser In-Reply-To: References: <78014D03-BD59-486C-AEEC-99618D2C3C98@swierstra.net> Message-ID: <21ACA907-DCEA-4E3E-A424-8E865F4A0373@swierstra.net> > On 13 Jan 2015, at 14:25 , Marco Vassena wrote: > >> The thing to do it to use the pList combinator which is greedy (the pList_ng counterpart is non-greedy): >> >> pContent = Content <$> pList (satisfy (/= '<')) > > Checking the source code pList is defined in terms of pFoldr, which uses opt, which eventually is defined in terms of <<|>. > >> An even better approach would be to reflect the structure of your HTML in your parser: >> >> pContent = tag_semantics <$> pOpenTag <*> pContent <* pCloseTag > >> In case you re sure about the correctness of your HTML you might want to enforce, by using a monadic construct to check for the closing tag to correspons to the opening tag (note that I am in general not in favour of using monads, since they make the abstrcat interpretation going on expensive): >> >> pTagged = do t <- pOpentag >> c <- pContents >> pClosetag t >> return (Tagged t c) >> >> (of course with appropriate definitions for pOpentag and pCloseTag. > > Unfortunately in html there are also empty tags, which don't need to be closed. For instance the line-break tag
: >

Line break tags are
not closed

> > The bigger picture is that I am trying to figure out what are the core constructs needed to define a parser, therefore I want to > have a rather abstract interface. In my set of core constructs there are: > <$> : (a -> b) -> f a -> f b > <*> : f (a -> b) -> f a -> f b > <|> : f a -> f a -> f a -- (symmetric choice) > pure : a -> f a > fail : f a > pToken : f Char > > Is it possible to define a parser that applies the longest matching rule using these constructs only? > Or is it necessary to extend it with another primitive, for instance greedy choice <<|> ? > (Note that f is abstract and it is not necessarily uu-parsinglib parsers). > > Marco I do not think so. As long as your grammar is essentially ambiguous you will get all parses. Using the amb combinator you can capture this, and avoid the runtime error. Then you can lateron decide which tree too take. I am afraid however that this will may lead to an exponential blowup in your case. If the set og
like tags is statically known they might be taken care of in a special way? by the parser? Doaitse > > On 13/gen/2015, at 12.22, S. Doaitse Swierstra wrote: > >> >>> On 13 Jan 2015, at 11:57 , Marco Vassena wrote: >>> >>> In the uu-parsinglib the choice combinator (<|>) is symmetric and does not commit to any alternative. >>> If the grammar being parsed is ambiguous, the corresponding parser will fail at run time on an ambiguous input. >>> >>> Consider for instance this html parser. >>> >>> pTag = pOpenTag <|> pCloseTag <|> pCommentTag <|> pContent >>> >>> pContent = Content <$> some (satisfy (/= '<')) >>> pHtml = some pTag >>> >>> This parser will fail on "123", because this may be interpreted as: >>> [ [Open a , Content "123", Close a], >>> [Open a, Content "12", Content "3", Close a], >>> [Open a, Content "1", Content "2", Content "3", Close a] ... ] >>> >>> In other parsing libraries such as parsec the choice operator <|> is greedy and commits to the first alternative that makes >>> any progress, so that some is greedy and Content "123" would be parsed. >>> The operator <<|> in uu-parsinglib has the same greedy behaviour. >>> >>> I would like to disambiguate the grammar so that the first result ([Open a, Content "123", Close a]) is selected (longest matching rule). >>> I suppose that this may be done using <<|> to define a greedySome to be used in in pContent, however I am wondering whether >>> there is another way to do this, without using such operator <<|>. >> >> The thing to do it to use the pList combinator which is greedy (the pList_ng counterpart is non-greedy): >> >> pContent = Content <$> pList (satisfy (/= '<')) >> >> An even better approach would be to reflect the structure of your HTML in your parser: >> >> pContent = tag_semantics <$> pOpenTag <*> pContent <* pCloseTag >> >> In case you re sure about the correctness of your HTML you might want to enforce, by using a monadic construct to check for the closing tag to correspons to the opening tag (note that I am in general not in favour of using monads, since they make the abstrcat interpretation going on expensive): >> >> pTagged = do t <- pOpentag >> c <- pContents >> pClosetag t >> return (Tagged t c) >> >> (of course with appropriate definitions for pOpentag and pCloseTag. >> >> Finally the module BasicInstances contains a combinator pMunch which you could have used: >> >> pContent = Content <$> pMunch (/= '<') >> >> This is far more efficient since it operates directly at the state. >> >> Doaitse >> >> >> >> >>> >>> Any help is appreciated. >>> >>> All the best, >>> Marco >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From johan.tibell at gmail.com Tue Jan 13 13:59:04 2015 From: johan.tibell at gmail.com (Johan Tibell) Date: Tue, 13 Jan 2015 05:59:04 -0800 Subject: [Haskell-cafe] --disable-{executable-}profiling cabal-install-1.22.0.0 with ghc-7.6.3 In-Reply-To: References: Message-ID: I wonder if you have a cached Setup.hs somewhere under ~/.cabal that's out of date (i.e. uses and older Cabal). You can try -v2 or -v3 to get some more information. In particular look for mentions of older Cabal versions. On Tue, Jan 13, 2015 at 5:53 AM, Ozgur Akgun wrote: > > On 13 January 2015 at 13:43, Ozgur Akgun wrote: > >> To be precise, I ran the following and can use --disable-profiling with >> ghc-7.6.3 now. >> > > I spoke too early. > > Weird problem, running `cabal install --disable-profiling -j1` works, but > using a higher number of cores I get the same error during cabal configure. > Here is what I did. > > > $ ghc -V > The Glorious Glasgow Haskell Compilation System, version 7.6.3 > $ cabal -V > cabal-install version 1.22.0.0 > using version 1.22.0.0 of the Cabal library > $ cabal install -j3 --disable-profiling mtl > Resolving dependencies... > Configuring transformers-0.4.2.0... > Failed to install transformers-0.4.2.0 > Build log [...]: > unrecognized 'configure' option `--disable-profiling' > cabal: Error: some packages failed to install: > mtl-2.2.1 depends on transformers-0.4.2.0 which failed to install. > transformers-0.4.2.0 failed during the configure step. The exception was: > ExitFailure 1 > $ cabal install -j1 --disable-profiling mtl > (This works fine.) > > Am I missing something? > > Ozgur > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicholls.mark at vimn.com Tue Jan 13 14:10:22 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Tue, 13 Jan 2015 14:10:22 +0000 Subject: [Haskell-cafe] working my way through Data.Type.Equality...my head hurts... In-Reply-To: <201501131433.25479.jan.stolarek@p.lodz.pl> References: <201501131413.24107.jan.stolarek@p.lodz.pl> <201501131433.25479.jan.stolarek@p.lodz.pl> Message-ID: I was thinking of doing it the other way around.... i.e. get my head around Haskell....then around Haskell's type system extensions....then look at agda. CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. From ollie at ocharles.org.uk Tue Jan 13 14:13:27 2015 From: ollie at ocharles.org.uk (Oliver Charles) Date: Tue, 13 Jan 2015 14:13:27 +0000 Subject: [Haskell-cafe] working my way through Data.Type.Equality...my head hurts... In-Reply-To: References: <201501131413.24107.jan.stolarek@p.lodz.pl> <201501131433.25479.jan.stolarek@p.lodz.pl> Message-ID: It can be done that way, but just keep in mind that a lot of things are significantly more complicated than they need to be in Haskell, when compared to Agda. Idris might be a good option to explore too, as you get very familiar syntax, but something that's designed from the start for dependent typing. On Tue, Jan 13, 2015 at 2:10 PM, Nicholls, Mark wrote: > I was thinking of doing it the other way around.... > i.e. get my head around Haskell....then around Haskell's type system > extensions....then look at agda. > > > CONFIDENTIALITY NOTICE > > This e-mail (and any attached files) is confidential and protected by > copyright (and other intellectual property rights). If you are not the > intended recipient please e-mail the sender and then delete the email and > any attached files immediately. Any further use or dissemination is > prohibited. > > While MTV Networks Europe has taken steps to ensure that this email and > any attachments are virus free, it is your responsibility to ensure that > this message and any attachments are virus free and do not affect your > systems / data. > > Communicating by email is not 100% secure and carries risks such as delay, > data corruption, non-delivery, wrongful interception and unauthorised > amendment. If you communicate with us by e-mail, you acknowledge and assume > these risks, and you agree to take appropriate measures to minimise these > risks when e-mailing us. > > MTV Networks International, MTV Networks UK & Ireland, Greenhouse, > Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions > International, Be Viacom, Viacom International Media Networks and VIMN and > Comedy Central are all trading names of MTV Networks Europe. MTV Networks > Europe is a partnership between MTV Networks Europe Inc. and Viacom > Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley > Crescent, London, NW1 8TT. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.stolarek at p.lodz.pl Tue Jan 13 14:14:02 2015 From: jan.stolarek at p.lodz.pl (Jan Stolarek) Date: Tue, 13 Jan 2015 15:14:02 +0100 Subject: [Haskell-cafe] working my way through Data.Type.Equality...my head hurts... In-Reply-To: References: <201501131433.25479.jan.stolarek@p.lodz.pl> Message-ID: <201501131514.02591.jan.stolarek@p.lodz.pl> Why not, if you feel that works for you. But in Agda you don't need things like Type Families or some fancy encodings like singletons - you can use the same functions at term and type levels. Janek Dnia wtorek, 13 stycznia 2015, Nicholls, Mark napisa?: > I was thinking of doing it the other way around.... > i.e. get my head around Haskell....then around Haskell's type system > extensions....then look at agda. > > > CONFIDENTIALITY NOTICE > > This e-mail (and any attached files) is confidential and protected by > copyright (and other intellectual property rights). If you are not the > intended recipient please e-mail the sender and then delete the email and > any attached files immediately. Any further use or dissemination is > prohibited. > > While MTV Networks Europe has taken steps to ensure that this email and any > attachments are virus free, it is your responsibility to ensure that this > message and any attachments are virus free and do not affect your systems / > data. > > Communicating by email is not 100% secure and carries risks such as delay, > data corruption, non-delivery, wrongful interception and unauthorised > amendment. If you communicate with us by e-mail, you acknowledge and assume > these risks, and you agree to take appropriate measures to minimise these > risks when e-mailing us. > > MTV Networks International, MTV Networks UK & Ireland, Greenhouse, > Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions > International, Be Viacom, Viacom International Media Networks and VIMN and > Comedy Central are all trading names of MTV Networks Europe. MTV Networks > Europe is a partnership between MTV Networks Europe Inc. and Viacom > Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley > Crescent, London, NW1 8TT. From ozgurakgun at gmail.com Tue Jan 13 14:26:16 2015 From: ozgurakgun at gmail.com (Ozgur Akgun) Date: Tue, 13 Jan 2015 14:26:16 +0000 Subject: [Haskell-cafe] --disable-{executable-}profiling cabal-install-1.22.0.0 with ghc-7.6.3 In-Reply-To: References: Message-ID: On 13 January 2015 at 13:59, Johan Tibell wrote: > I wonder if you have a cached Setup.hs somewhere under ~/.cabal that's out > of date (i.e. uses and older Cabal). You can try -v2 or -v3 to get some > more information. In particular look for mentions of older Cabal versions. > This is probably it. With -v3 I see the following in the output. Using Cabal library version 1.20.0.0 Found cached setup executable: $HOME/.cabal/setup-exe-cache/setup-Simple-Cabal-1.20.0.0-x86_64-osx-ghc-7.6.3 $HOME/.cabal/setup-exe-cache/setup-Simple-Cabal-1.20.0.0-x86_64-osx-ghc-7.6.3 Then I rm -rf $HOME/.cabal/setup-exe-cache, but this doesn't seem to help. Using Cabal library version 1.20.0.0 Setup executable not found in the cache. Setup executable needs to be updated, compiling... So it compiles the Setup executable using Cabal-1.20.0.0 again. And now I know why this happens. I had compiled cabal-install using ghc-7.8.3 before. So 7.6.3 doesn't even have Cabal-1.22.0.0 available to it. Compiling cabal-install with ghc-7.6.3 seems to have solved that problem. This is getting a little bit out of hand though, especially for automation. Now I need to figure out what to do for our continuous integration machines so the latest version of cabal-install is useable for multiple ghc versions. In general, should we be compiling cabal-install with each ghc installation separately? Or maybe just the Cabal library? Thanks, -- Ozgur Akgun -------------- next part -------------- An HTML attachment was scrubbed... URL: From mathieu at fpcomplete.com Tue Jan 13 14:31:55 2015 From: mathieu at fpcomplete.com (Mathieu Boespflug) Date: Tue, 13 Jan 2015 15:31:55 +0100 Subject: [Haskell-cafe] FP Complete is hiring: Software engineer Message-ID: Hi list, FP Complete is expanding yet again! We are looking to hire for several new engineers to join our Haskell development team, both to build great new core products and in partnership with our clients to apply Haskell at a large scale. Some of our recently announced core products include the Integrated Analysis Platform, Stackage and LTS Haskell, with much more to come. If you?d like to be part of our team and shape the future of Haskell, please send a resume or CV to jobs+dev at fpcomplete.com. Any existing work - either a running website or an open source codebase - which you can include as links be greatly appreciated as well. We will want you to start right away. Depending on your current jurisdiction, this will either be a full-time contractor position, or an employee position. This is a telecommute position: you can work from home or wherever you choose, with little or no travel. Location in North America preferred; but you will work with colleagues who are both on North American and European hours. Activities: * distribute existing and new code over large clusters, * code parallelization and performance tuning, * interface with foreign math and scientific libraries, * relentlessly refactor for composability, testability and clarity, * identify performance bottlenecks and debug known issues, * implementing unit tests, integration tests, acceptance tests, * write clear and concise documentation. Skills: * strong experience writing process driven application code in Haskell. * experience building reusable components/packages/libraries and demonstrated ability to write well structured and well documented code, * ability to evolve and refactor large code bases, * experience working under test driven methodologies, * Ability to interact with a distributed development team, and to communicate clearly on issues, in bug reports and emails. These further skills are a plus: * Bachelor?s or Master?s degree in computer science or mathematics, * experience developing products in a regulated environment (avionics/medical/finance). * experience building scalable server/Web applications, * (web) UI design and implementation experience, * an understanding of the implementation of GHC?s multithreaded runtime, * experience as an architect and/or a creator of technical specs. -------------- next part -------------- An HTML attachment was scrubbed... URL: From johan.tibell at gmail.com Tue Jan 13 14:31:56 2015 From: johan.tibell at gmail.com (Johan Tibell) Date: Tue, 13 Jan 2015 06:31:56 -0800 Subject: [Haskell-cafe] --disable-{executable-}profiling cabal-install-1.22.0.0 with ghc-7.6.3 In-Reply-To: References: Message-ID: On Tue, Jan 13, 2015 at 6:26 AM, Ozgur Akgun wrote: > > On 13 January 2015 at 13:59, Johan Tibell wrote: > >> I wonder if you have a cached Setup.hs somewhere under ~/.cabal that's >> out of date (i.e. uses and older Cabal). You can try -v2 or -v3 to get some >> more information. In particular look for mentions of older Cabal versions. >> > > This is probably it. With -v3 I see the following in the output. > > Using Cabal library version 1.20.0.0 > Found cached setup executable: > > $HOME/.cabal/setup-exe-cache/setup-Simple-Cabal-1.20.0.0-x86_64-osx-ghc-7.6.3 > > $HOME/.cabal/setup-exe-cache/setup-Simple-Cabal-1.20.0.0-x86_64-osx-ghc-7.6.3 > > Then I rm -rf $HOME/.cabal/setup-exe-cache, but this doesn't seem to help. > > Using Cabal library version 1.20.0.0 > Setup executable not found in the cache. > Setup executable needs to be updated, compiling... > > So it compiles the Setup executable using Cabal-1.20.0.0 again. > > And now I know why this happens. I had compiled cabal-install using > ghc-7.8.3 before. So 7.6.3 doesn't even have Cabal-1.22.0.0 available to > it. Compiling cabal-install with ghc-7.6.3 seems to have solved that > problem. > > This is getting a little bit out of hand though, especially for > automation. Now I need to figure out what to do for our continuous > integration machines so the latest version of cabal-install is useable for > multiple ghc versions. In general, should we be compiling cabal-install > with each ghc installation separately? Or maybe just the Cabal library? > > Thanks, > > -- > Ozgur Akgun > -------------- next part -------------- An HTML attachment was scrubbed... URL: From johan.tibell at gmail.com Tue Jan 13 14:56:14 2015 From: johan.tibell at gmail.com (Johan Tibell) Date: Tue, 13 Jan 2015 06:56:14 -0800 Subject: [Haskell-cafe] --disable-{executable-}profiling cabal-install-1.22.0.0 with ghc-7.6.3 In-Reply-To: References: Message-ID: Chatted a bit with Duncan. cabal-install needs to be prepared to handle calling older Cabal lib versions. In this case cabal-install needs to check which Cabal install version was used (or rather, which of the available versions it wants to use) and then call the setup executable correctly (in this case not passing --disable-profiling to older Cabals, but instead using the old flag.) On Tue, Jan 13, 2015 at 6:31 AM, Johan Tibell wrote: > > > On Tue, Jan 13, 2015 at 6:26 AM, Ozgur Akgun wrote: > >> >> On 13 January 2015 at 13:59, Johan Tibell wrote: >> >>> I wonder if you have a cached Setup.hs somewhere under ~/.cabal that's >>> out of date (i.e. uses and older Cabal). You can try -v2 or -v3 to get some >>> more information. In particular look for mentions of older Cabal versions. >>> >> >> This is probably it. With -v3 I see the following in the output. >> >> Using Cabal library version 1.20.0.0 >> Found cached setup executable: >> >> $HOME/.cabal/setup-exe-cache/setup-Simple-Cabal-1.20.0.0-x86_64-osx-ghc-7.6.3 >> >> $HOME/.cabal/setup-exe-cache/setup-Simple-Cabal-1.20.0.0-x86_64-osx-ghc-7.6.3 >> >> Then I rm -rf $HOME/.cabal/setup-exe-cache, but this doesn't seem to >> help. >> >> Using Cabal library version 1.20.0.0 >> Setup executable not found in the cache. >> Setup executable needs to be updated, compiling... >> >> So it compiles the Setup executable using Cabal-1.20.0.0 again. >> >> And now I know why this happens. I had compiled cabal-install using >> ghc-7.8.3 before. So 7.6.3 doesn't even have Cabal-1.22.0.0 available to >> it. Compiling cabal-install with ghc-7.6.3 seems to have solved that >> problem. >> >> This is getting a little bit out of hand though, especially for >> automation. Now I need to figure out what to do for our continuous >> integration machines so the latest version of cabal-install is useable for >> multiple ghc versions. In general, should we be compiling cabal-install >> with each ghc installation separately? Or maybe just the Cabal library? >> >> Thanks, >> >> -- >> Ozgur Akgun >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kyle.marek.spartz at gmail.com Tue Jan 13 15:45:02 2015 From: kyle.marek.spartz at gmail.com (Kyle Marek-Spartz) Date: Tue, 13 Jan 2015 09:45:02 -0600 Subject: [Haskell-cafe] uu-parsinglib - Greedy Parser In-Reply-To: References: Message-ID: <2fcp3sr3uyn0qp.fsf@kmarekspartz-mbp.stp01.office.gdi> This is the difference between Parsing Expression Grammars and more general Context-Free Grammars. https://en.wikipedia.org/wiki/Parsing_expression_grammar You'll have to re-write your grammar to be unambiguous if you want to use a library based on CFGs. Marco Vassena writes: > In the uu-parsinglib the choice combinator (<|>) is symmetric and does not commit to any alternative. > If the grammar being parsed is ambiguous, the corresponding parser will fail at run time on an ambiguous input. > > Consider for instance this html parser. > > pTag = pOpenTag <|> pCloseTag <|> pCommentTag <|> pContent > > pContent = Content <$> some (satisfy (/= '<')) > pHtml = some pTag > > This parser will fail on "123", because this may be interpreted as: > [ [Open a , Content "123", Close a], > [Open a, Content "12", Content "3", Close a], > [Open a, Content "1", Content "2", Content "3", Close a] ... ] > > In other parsing libraries such as parsec the choice operator <|> is greedy and commits to the first alternative that makes > any progress, so that some is greedy and Content "123" would be parsed. > The operator <<|> in uu-parsinglib has the same greedy behaviour. > > I would like to disambiguate the grammar so that the first result ([Open a, Content "123", Close a]) is selected (longest matching rule). > I suppose that this may be done using <<|> to define a greedySome to be used in in pContent, however I am wondering whether > there is another way to do this, without using such operator <<|>. > > Any help is appreciated. > > All the best, > Marco > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -- Kyle Marek-Spartz From mblazevic at stilo.com Tue Jan 13 15:48:59 2015 From: mblazevic at stilo.com (=?UTF-8?B?TWFyaW8gQmxhxb5ldmnEhw==?=) Date: Tue, 13 Jan 2015 10:48:59 -0500 Subject: [Haskell-cafe] uu-parsinglib - Greedy Parser In-Reply-To: References: <78014D03-BD59-486C-AEEC-99618D2C3C98@swierstra.net> Message-ID: <54B53E6B.9030202@stilo.com> On 15-01-13 08:25 AM, Marco Vassena wrote: > Unfortunately in html there are also empty tags, which don't need to > be closed. For instance the line-break tag
:

Line break tags > are
not closed

> > The bigger picture is that I am trying to figure out what are the > core constructs needed to define a parser, therefore I want to have a > rather abstract interface. In my set of core constructs there are: > <$> : (a -> b) -> f a -> f b > <*> : f (a -> b) -> f a -> f b > <|> : f a -> f a -> f a -- (symmetric choice) > pure : a -> f a > fail : f a > pToken : f Char > > Is it possible to define a parser that applies the longest matching > rule using these constructs only? Or is it necessary to extend it > with another primitive, for instance greedy choice <<|> ? (Note that > f is abstract and it is not necessarily uu-parsinglib parsers). You can parse HTML with no ambiguous results if you allow monadic bind (>>=) as well: pTag = pElement <|> pCommentTag <|> pContent pElement = do elemName <- pOpenTag elemContent <- pTag `manyTill` endElement elemName endElement elemName = string " string elemName *> string ">" <|> lookahead (string " some (satisfy (/= '>')) *> string ">") pContent = Content <$> some (satisfy (/= '<')) pHtml = some pTag Mind you, this code would not give you exactly the same parse tree as an HTML 5 browser would. That spec is a nightmare. From ozgurakgun at gmail.com Tue Jan 13 16:01:24 2015 From: ozgurakgun at gmail.com (Ozgur Akgun) Date: Tue, 13 Jan 2015 16:01:24 +0000 Subject: [Haskell-cafe] --disable-{executable-}profiling cabal-install-1.22.0.0 with ghc-7.6.3 In-Reply-To: References: Message-ID: On 13 January 2015 at 14:56, Johan Tibell wrote: > Chatted a bit with Duncan. cabal-install needs to be prepared to handle > calling older Cabal lib versions. In this case cabal-install needs to check > which Cabal install version was used (or rather, which of the available > versions it wants to use) and then call the setup executable correctly (in > this case not passing --disable-profiling to older Cabals, but instead > using the old flag.) > This sounds reasonable. There must be a reason since you are not doing so already, but what is the reason for not requiring Cabal-1.22.0.0 for cabal-install-1.22.0.0 in the first place? Ozgur -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicholls.mark at vimn.com Tue Jan 13 16:02:50 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Tue, 13 Jan 2015 16:02:50 +0000 Subject: [Haskell-cafe] working my way through Data.Type.Equality...my head hurts... In-Reply-To: <201501131433.25479.jan.stolarek@p.lodz.pl> References: <201501131413.24107.jan.stolarek@p.lodz.pl> <201501131433.25479.jan.stolarek@p.lodz.pl> Message-ID: Hmmm scanning the paper I think it easier to read the code and follow the paper. The paper is a little intractable. > the 1st link is a bit challenging... You may want to read 3rd chapter of Okasaki's "Purely Functional Data Structures" - it describes weight-biased lefitsh heaps without any type-level magic. > the 2nd I can probably cope with for the moment, though I may be asking questions. As you probably noticed this is based on paper "Why Dependent Types Matter", so you should probably read the paper and follow the code. > If you have any beginner level tutorial, then that?s even better.. I personally learned all these things in Agda. It's a bit easier because it's a fully-fledged dependently-typed language and things are just easier to write. Only then I moved to Haskell. Janek > I can > just about cope with associated types, type families and GADT...some > of the other extensions I suspect disbelief for. > > > What does ?~? mean?(it?s something that comes out in error messages > > when my types are all messed up)?. > > It means GHC knows that two types are equal. > > > and then there?s a ?=>? going on?in the middle of a signature?.I > > know ?=>? in the context of ?Num a => a -> a -> a? > > Yeah, that looks scary. You use gcastWith when you need a value of > type a but you have a value of type b with a proof that a and b are > equal (here a proof is a value of a :~: b). I have a practical > example, though perhaps it's not the simplest one: > > >https://github.com/jstolarek/dep-typed-wbl-heaps-hs/blob/master/src/Two >Pass >Merge/RankProof.hs#L361 > > This code is thought as an intermediate level tutorial - you might > want to give it a try. Another example I have is here (I use the name > subst, but it's identical to gcastWith): > > >https://github.com/jstolarek/why-dependent-types-matter/blob/master/Why >Depe >ndentTypesMatter.hs#L220 > > HTH > > Janek > > CONFIDENTIALITY NOTICE > > This e-mail (and any attached files) is confidential and protected by > copyright (and other intellectual property rights). If you are not the > intended recipient please e-mail the sender and then delete the email > and any attached files immediately. Any further use or dissemination > is prohibited. > > While MTV Networks Europe has taken steps to ensure that this email > and any attachments are virus free, it is your responsibility to > ensure that this message and any attachments are virus free and do not > affect your systems / data. > > Communicating by email is not 100% secure and carries risks such as > delay, data corruption, non-delivery, wrongful interception and > unauthorised amendment. If you communicate with us by e-mail, you > acknowledge and assume these risks, and you agree to take appropriate > measures to minimise these risks when e-mailing us. > > MTV Networks International, MTV Networks UK & Ireland, Greenhouse, > Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions > International, Be Viacom, Viacom International Media Networks and VIMN > and Comedy Central are all trading names of MTV Networks Europe. MTV > Networks Europe is a partnership between MTV Networks Europe Inc. and > Viacom Networks Europe Inc. Address for service in Great Britain is > 17-29 Hawley Crescent, London, NW1 8TT. CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. From johan.tibell at gmail.com Tue Jan 13 16:08:59 2015 From: johan.tibell at gmail.com (Johan Tibell) Date: Tue, 13 Jan 2015 08:08:59 -0800 Subject: [Haskell-cafe] --disable-{executable-}profiling cabal-install-1.22.0.0 with ghc-7.6.3 In-Reply-To: References: Message-ID: Just to separate two things: cabal-install, the executable itself, must be compiled against a matching Cabal version. An external Setup executable can be compiled against an older version, if that's all that's available. One reason that only an old Cabal might be available is that you're using a cabal-install against some old GHC version you have installed, which shipped with an old Cabal. It's a more friendly behavior than saying "you must upgrade Cabal". On Tue, Jan 13, 2015 at 8:01 AM, Ozgur Akgun wrote: > > On 13 January 2015 at 14:56, Johan Tibell wrote: > >> Chatted a bit with Duncan. cabal-install needs to be prepared to handle >> calling older Cabal lib versions. In this case cabal-install needs to check >> which Cabal install version was used (or rather, which of the available >> versions it wants to use) and then call the setup executable correctly (in >> this case not passing --disable-profiling to older Cabals, but instead >> using the old flag.) >> > > This sounds reasonable. There must be a reason since you are not doing so > already, but what is the reason for not requiring Cabal-1.22.0.0 for > cabal-install-1.22.0.0 in the first place? > > Ozgur > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominic at steinitz.org Tue Jan 13 16:11:27 2015 From: dominic at steinitz.org (Dominic Steinitz) Date: Tue, 13 Jan 2015 16:11:27 +0000 (UTC) Subject: [Haskell-cafe] =?utf-8?q?working_my_way_through_Data=2EType=2EEqu?= =?utf-8?b?YWxpdHkuLi5teSBoZWFkCWh1cnRzLi4u?= References: Message-ID: Nicholls, Mark vimn.com> writes: > > > > Full code here? > https://github.com/goldfirere/nyc-hug-oct2014/blob/master/Equality.hs > ? ... That's a very good question. Apart from a reference in the ghc manual, I have been unable to find a reference for "~". It doesn't exist in the Haskell 2010 Language Report, it didn?t exist in ghc 6.8.2 but made an appearance in 7.0.1. The documentation in the manual is rather sparse and doesn?t contain a reference: https://downloads.haskell.org/~ghc/latest/docs/users_guide.pdf section 7.11. Folk on #ghc referred me to http://research.microsoft.com/en-us/um/people/simonpj/papers/ext-f/. I can find papers that refer to ~ in F_C (aka FC?) but as far as I can tell not in the Haskell language itself. Apparently: They were introduced as part of the System Fc rewrite. The Fc approach has the benefit of unifying a lot of the work on GADTs, functional dependencies, type and data families, etc. all behind the scenes. Every once in a while, (~) constraints can leak into the surface language and it can be useful to be able to talk about them in the surface language of Haskell, because otherwise it isn't clear how to talk about F a ~ G b style constraints, which arise in practice when you work with type families. I don't know if this is correct way to think about them but I think of ":~:" as internal equality and "~" as external equality and gcastWith allows you to use a proof using internal equality to discharge a proof of external equality. For example suppose you have a type family > type family (n :: Nat) :+ (m :: Nat) :: Nat where > Z :+ m = m > S n :+ m = n :+ S m and a proof > plus_id_r :: SNat n -> ((n :+ Z) :~: n) then you could use this with a definition of a vector > data Vec a n where > Nil :: Vec a Z > (:::) :: a -> Vec a n -> Vec a (S n) to prove > elim0 :: SNat n -> (Vec a (n :+ Z) -> Vec a n) > elim0 n x = gcastWith (plus_id_r n) x PS Nat and SNat are the usual natural numbers and singleton. From nicholls.mark at vimn.com Tue Jan 13 16:27:30 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Tue, 13 Jan 2015 16:27:30 +0000 Subject: [Haskell-cafe] working my way through Data.Type.Equality...my head hurts... In-Reply-To: References: Message-ID: Hmmm ok And what is a singleton type!...I think this is a phrase I have chosen to ignore up to now. > > > > Full code here? > https://github.com/goldfirere/nyc-hug-oct2014/blob/master/Equality.hs > ? ... That's a very good question. Apart from a reference in the ghc manual, I have been unable to find a reference for "~". It doesn't exist in the Haskell 2010 Language Report, it didn?t exist in ghc 6.8.2 but made an appearance in 7.0.1. The documentation in the manual is rather sparse and doesn?t contain a reference: https://downloads.haskell.org/~ghc/latest/docs/users_guide.pdf section 7.11. Folk on #ghc referred me to http://research.microsoft.com/en-us/um/people/simonpj/papers/ext-f/. I can find papers that refer to ~ in F_C (aka FC?) but as far as I can tell not in the Haskell language itself. Apparently: They were introduced as part of the System Fc rewrite. The Fc approach has the benefit of unifying a lot of the work on GADTs, functional dependencies, type and data families, etc. all behind the scenes. Every once in a while, (~) constraints can leak into the surface language and it can be useful to be able to talk about them in the surface language of Haskell, because otherwise it isn't clear how to talk about F a ~ G b style constraints, which arise in practice when you work with type families. I don't know if this is correct way to think about them but I think of ":~:" as internal equality and "~" as external equality and gcastWith allows you to use a proof using internal equality to discharge a proof of external equality. For example suppose you have a type family > type family (n :: Nat) :+ (m :: Nat) :: Nat where > Z :+ m = m > S n :+ m = n :+ S m and a proof > plus_id_r :: SNat n -> ((n :+ Z) :~: n) then you could use this with a definition of a vector > data Vec a n where > Nil :: Vec a Z > (:::) :: a -> Vec a n -> Vec a (S n) to prove > elim0 :: SNat n -> (Vec a (n :+ Z) -> Vec a n) > elim0 n x = gcastWith (plus_id_r n) x PS Nat and SNat are the usual natural numbers and singleton. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. From ozgurakgun at gmail.com Tue Jan 13 16:38:42 2015 From: ozgurakgun at gmail.com (Ozgur Akgun) Date: Tue, 13 Jan 2015 16:38:42 +0000 Subject: [Haskell-cafe] --disable-{executable-}profiling cabal-install-1.22.0.0 with ghc-7.6.3 In-Reply-To: References: Message-ID: I see now, thanks for the additional explanation. Ozgur On 13 January 2015 at 16:08, Johan Tibell wrote: > Just to separate two things: cabal-install, the executable itself, must be > compiled against a matching Cabal version. An external Setup executable can > be compiled against an older version, if that's all that's available. One > reason that only an old Cabal might be available is that you're using a > cabal-install against some old GHC version you have installed, which > shipped with an old Cabal. > > It's a more friendly behavior than saying "you must upgrade Cabal". > > On Tue, Jan 13, 2015 at 8:01 AM, Ozgur Akgun wrote: > >> >> On 13 January 2015 at 14:56, Johan Tibell wrote: >> >>> Chatted a bit with Duncan. cabal-install needs to be prepared to handle >>> calling older Cabal lib versions. In this case cabal-install needs to check >>> which Cabal install version was used (or rather, which of the available >>> versions it wants to use) and then call the setup executable correctly (in >>> this case not passing --disable-profiling to older Cabals, but instead >>> using the old flag.) >>> >> >> This sounds reasonable. There must be a reason since you are not doing so >> already, but what is the reason for not requiring Cabal-1.22.0.0 for >> cabal-install-1.22.0.0 in the first place? >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From eir at cis.upenn.edu Tue Jan 13 17:12:39 2015 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Tue, 13 Jan 2015 12:12:39 -0500 Subject: [Haskell-cafe] working my way through Data.Type.Equality...my head hurts... In-Reply-To: References: Message-ID: <4EBE6C37-3AE8-41ED-946E-E63EAA3BC688@cis.upenn.edu> Hi Mark, Permit me to take a stab from the beginning. On Jan 13, 2015, at 7:39 AM, "Nicholls, Mark" wrote: > Full code here? > https://github.com/goldfirere/nyc-hug-oct2014/blob/master/Equality.hs > First off, I should point out that Data.Type.Equality, while indeed served at the address above, is now a standard library. The code in that repo is identical to the version that ships with GHC 7.8. > Lets start at the beginning? > > ? data a :~: b where > ? Refl :: a :~: a > > Looks reasonable?.? a :~: b? is inhabited by 1 value?of type ?a :~: a? This is true, but there's a bit more going on. If, say, we learn that the type `foo :~: bar` is indeed inhabited by `Refl`, then we know that `foo` and `bar` are the same types. That is > baz :: foo :~: bar -> ... > baz evidence = case evidence of > Refl -> -- here, we may assume that `foo` and `bar` are fully identical Conversely, whenever we *use* `Refl` in an expression, we must know that the two types being related are indeed equal. > > > ? sym :: (a :~: b) -> (b :~: a) > ? sym Refl = Refl > > hmmm? (a :~: b) implies that a is b > so (b :~: a) > brilliant Yes. After pattern-matching on `Refl`, GHC learns that `a` is identical to `b`. Thus, when we use `Refl` on the right-hand side, we know `b` is the same as `a`, and thus the use of `Refl` type checks. > > ? -- | Transitivity of equality > ? trans :: (a :~: b) -> (b :~: c) -> (a :~: c) > ? trans Refl Refl = Refl > > ? -- | Type-safe cast, using propositional equality > ? castWith :: (a :~: b) -> a -> b > ? castWith Refl x = x > > fine?. > > But?. > > ? -- | Generalized form of type-safe cast using propositional equality > ? gcastWith :: (a :~: b) -> ((a ~ b) => r) -> r > ? gcastWith Refl x = x > > I don?t even understand the signature > > What does ?~? mean?(it?s something that comes out in error messages when my types are all messed up)?.and then there?s a ?=>? going on?in the middle of a signature?.I know ?=>? in the context of ?Num a => a -> a -> a? While the comments I've seen about `~` are quite true, I think there's a simpler way to explain it. `~` is simply equality on types. The constraint `a ~ b` means that `a` is the same type as `b`. We could have spelled it `=` if that weren't used elsewhere. Before `~` was added to GHC, it might have been implemented like this: > class Equals a b | a -> b, b -> a > instance Equals x x > -- no other instances! The proper `~` works better in type inference than this functional-dependency approach, but perhaps rewriting `~` in terms of functional dependencies is illuminating. When a constraint `a ~ b` is in the context, then GHC assumes the types are the same, and freely rewrites one to the other. The type `(a ~ b) => r` above is a higher-rank type, which is why it may look strange to you. Let's skip the precise definition of "higher-rank" for now. In practical terms: let's say you write `gcastWith proof x` in your program. By the type signature of `gcastWith`, GHC knows that `proof` must have type `a :~: b` for some `a` and `b`. It further knows that `x` has the type `(a ~ b) => r`, for some `r`, but the same `a` and `b`. Of course, if a Haskell expression as a type `constraint => stuff`, then GHC can assume `constraint` when type-checking the expression. The same holds here: GHC assumes `a ~ b` (that is, `a` and `b` are identical) when type-checking the expression `x`. Perhaps, somewhere deep inside `x`, you pass a variable of type `a` to a function expecting a `b` -- that's just fine, because `a` and `b` are the same. The `r` type variable in the type of `gcastWith` is the type of the result. It's the type you would naively give to `x`, but without a particular assumption that `a` and `b` are the same. > > What would a value of type ?((a ~ b) => r)? look like? It looks just like a value of type `r`. Except that GHC has an extra assumption during type-checking. Contrast this to, say, > min :: Ord a => a -> a -> a > min = \x y -> if x < y then x else y What does a value of `Ord a => a -> a -> a` look like? Identically to a value of type `a -> a -> a`, except with an extra assumption. This is just like the type `(a ~ b) => r`, just less exotic-looking. As for singleton types and dependent types: they're great fun, but I don't think you need to go anywhere near there to understand this module. (Other modules in that repo, on the other hand, get scarier...) > I hope this helps! Richard -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicholls.mark at vimn.com Tue Jan 13 17:29:50 2015 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Tue, 13 Jan 2015 17:29:50 +0000 Subject: [Haskell-cafe] working my way through Data.Type.Equality...my head hurts... In-Reply-To: <4EBE6C37-3AE8-41ED-946E-E63EAA3BC688@cis.upenn.edu> References: <4EBE6C37-3AE8-41ED-946E-E63EAA3BC688@cis.upenn.edu> Message-ID: Brilliant! Let my cogs turn....slowly... I think the problem I will have writing these proofs, is how much the compiler "knows" at a given point is not especially clear....you have to build a mental model of what its doing. Interesting stuff though. From: Richard Eisenberg [mailto:eir at cis.upenn.edu] Sent: 13 January 2015 5:13 PM To: Nicholls, Mark Cc: haskell-cafe Subject: Re: [Haskell-cafe] working my way through Data.Type.Equality...my head hurts... Hi Mark, Permit me to take a stab from the beginning. On Jan 13, 2015, at 7:39 AM, "Nicholls, Mark" > wrote: Full code here... https://github.com/goldfirere/nyc-hug-oct2014/blob/master/Equality.hs First off, I should point out that Data.Type.Equality, while indeed served at the address above, is now a standard library. The code in that repo is identical to the version that ships with GHC 7.8. Lets start at the beginning... > data a :~: b where > Refl :: a :~: a Looks reasonable...." a :~: b" is inhabited by 1 value...of type "a :~: a" This is true, but there's a bit more going on. If, say, we learn that the type `foo :~: bar` is indeed inhabited by `Refl`, then we know that `foo` and `bar` are the same types. That is > baz :: foo :~: bar -> ... > baz evidence = case evidence of > Refl -> -- here, we may assume that `foo` and `bar` are fully identical Conversely, whenever we *use* `Refl` in an expression, we must know that the two types being related are indeed equal. > sym :: (a :~: b) -> (b :~: a) > sym Refl = Refl hmmm... (a :~: b) implies that a is b so (b :~: a) brilliant Yes. After pattern-matching on `Refl`, GHC learns that `a` is identical to `b`. Thus, when we use `Refl` on the right-hand side, we know `b` is the same as `a`, and thus the use of `Refl` type checks. > -- | Transitivity of equality > trans :: (a :~: b) -> (b :~: c) -> (a :~: c) > trans Refl Refl = Refl > -- | Type-safe cast, using propositional equality > castWith :: (a :~: b) -> a -> b > castWith Refl x = x fine.... But.... > -- | Generalized form of type-safe cast using propositional equality > gcastWith :: (a :~: b) -> ((a ~ b) => r) -> r > gcastWith Refl x = x I don't even understand the signature What does "~" mean...(it's something that comes out in error messages when my types are all messed up)....and then there's a "=>" going on...in the middle of a signature....I know "=>" in the context of "Num a => a -> a -> a" While the comments I've seen about `~` are quite true, I think there's a simpler way to explain it. `~` is simply equality on types. The constraint `a ~ b` means that `a` is the same type as `b`. We could have spelled it `=` if that weren't used elsewhere. Before `~` was added to GHC, it might have been implemented like this: > class Equals a b | a -> b, b -> a > instance Equals x x > -- no other instances! The proper `~` works better in type inference than this functional-dependency approach, but perhaps rewriting `~` in terms of functional dependencies is illuminating. When a constraint `a ~ b` is in the context, then GHC assumes the types are the same, and freely rewrites one to the other. The type `(a ~ b) => r` above is a higher-rank type, which is why it may look strange to you. Let's skip the precise definition of "higher-rank" for now. In practical terms: let's say you write `gcastWith proof x` in your program. By the type signature of `gcastWith`, GHC knows that `proof` must have type `a :~: b` for some `a` and `b`. It further knows that `x` has the type `(a ~ b) => r`, for some `r`, but the same `a` and `b`. Of course, if a Haskell expression as a type `constraint => stuff`, then GHC can assume `constraint` when type-checking the expression. The same holds here: GHC assumes `a ~ b` (that is, `a` and `b` are identical) when type-checking the expression `x`. Perhaps, somewhere deep inside `x`, you pass a variable of type `a` to a function expecting a `b` -- that's just fine, because `a` and `b` are the same. The `r` type variable in the type of `gcastWith` is the type of the result. It's the type you would naively give to `x`, but without a particular assumption that `a` and `b` are the same. What would a value of type "((a ~ b) => r)" look like? It looks just like a value of type `r`. Except that GHC has an extra assumption during type-checking. Contrast this to, say, > min :: Ord a => a -> a -> a > min = \x y -> if x < y then x else y What does a value of `Ord a => a -> a -> a` look like? Identically to a value of type `a -> a -> a`, except with an extra assumption. This is just like the type `(a ~ b) => r`, just less exotic-looking. As for singleton types and dependent types: they're great fun, but I don't think you need to go anywhere near there to understand this module. (Other modules in that repo, on the other hand, get scarier...) I hope this helps! Richard CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Tue Jan 13 23:02:13 2015 From: david.feuer at gmail.com (David Feuer) Date: Tue, 13 Jan 2015 18:02:13 -0500 Subject: [Haskell-cafe] Future of the boxes package--call for ideas Message-ID: I've just taken over maintainership of the boxes package, and will be making a maintenance release shortly (as soon as I figure out how and get added to the maintainers group). The package, however, currently suffers from a paucity of bug reports (no problem) and feature requests (not so great). To keep things lively, I need a bit of help from two groups of people. If you use the package but wish it could do something more for you, I want to know about it. If you considered using the package but rejected it because it couldn't quite handle your job, I want to know about that too. I'd prefer if people would open issues and pull requests at https://github.com/treeowl/boxes/issues but I will also accept requests by email. Thanks, David -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike at proclivis.com Tue Jan 13 23:04:43 2015 From: mike at proclivis.com (Michael Jones) Date: Tue, 13 Jan 2015 16:04:43 -0700 Subject: [Haskell-cafe] ParallelListComp strange behavior Message-ID: I am trying to use ParallelListComp and have code that compiles but only produces one value, but I am not clear why. The code is something like: gen :: (a -> b) -> [MyType] gen f = [MyType (Just []) (Just c) (Just d) Nothing | c <- f | d <- [1,2,3,4] When the gen function is used with take or any other function, only one value is returned. Is there something here that can?t desugar properly to mzip that will still compile? Note I did not test this specific code, I am just writing it here to represent the different pieces of a larger piece of real code which is below. Mike ???? Real Code ???? data Config = Config { onOffControl::Maybe [DEVICE_ON_OFF_CONTROL_BITS] , seqUpPos::[Maybe ([DEVICE_SEQ_UP_POSITION_BITS], Word16)] , seqDownPos::[Maybe ([DEVICE_SEQ_DOWN_POSITION_BITS], Word16)] , tonTimers::[Maybe ([DEVICE_TON_TIMERS_BITS], Word16)] , toffTimers::[Maybe ([DEVICE_TOFF_TIMERS_BITS], Word16)] , vRange::Maybe [DEVICE_V_RANGE_BITS] , vThresh::[Maybe (Word16, Word16)] , rstbConfig::Maybe [DEVICE_RSTB_CONFIG_BITS] , faultResponse::Maybe [DEVICE_FAULT_RESPONSE_BITS] , breakpoint::Maybe ([DEVICE_BREAK_POINT_BITS], Word16) , writeProtect::Maybe ([DEVICE_WRITE_PROTECTION_BITS], Word16) , specialLot::Maybe Word16 , deviceId::Maybe Word16 , statusInfo::Maybe ([DEVICE_STATUS_INFORMATION_BITS]) , monitorStatus::Maybe ([DEVICE_MONITOR_STATUS_BITS]) , monitorStatusHistory::Maybe ([DEVICE_MONITOR_STATUS_HISTORY_BITS]) , monitorBackup::Maybe ([DEVICE_MONITOR_BACKUP_BITS]) , seqPosCount::Maybe ([DEVICE_SEQ_POSITION_COUNT_BITS], Word16) generateConfigs seqValues delayValues threshValues = return [Config (Just []) -- On off ([Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos)]) ([Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos)]) ([Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay)]) ([Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay)]) (Just [rng1, rng2, rng3, rng4, rng5, rng6]) ([Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv)]) (Just ([rst_en] ++ [rst_time])) (Just ([fault_number] ++ [fault_action] ++ [fault_delay] ++ fault_other ++ [fault_count])) (Just ([], 0)) (Just ([], 0)) (Just 0) Nothing Nothing Nothing Nothing Nothing Nothing | suPol <- [DEVICE_seq_up_position_bits] | suPos <- seqValues | sdPol <- [DEVICE_seq_down_position_bits] | sdPos <- seqValues | tonMax <- DEVICE_ton_timers_bits | tonDelay <- delayValues | toffMax <- DEVICE_toff_timers_bits | toffDelay <- delayValues | rng1 <- DEVICE_v_range_bits1 | rng2 <- DEVICE_v_range_bits2 | rng3 <- DEVICE_v_range_bits3 | rng4 <- DEVICE_v_range_bits4 | rng5 <- DEVICE_v_range_bits5 | rng6 <- DEVICE_v_range_bits6 | threshOv <- threshValues | threshUv <- threshValues | rst_time <- DEVICE_rstb_config_bits_time | rst_en <- DEVICE_rstb_config_bits_en | fault_number <- DEVICE_fault_response_bits_retry_number | fault_other <- [DEVICE_fault_response_bits_other] | fault_count <- DEVICE_fault_response_bits_count | fault_delay <- DEVICE_fault_response_bits_delay | fault_action <- DEVICE_fault_response_bits_action ] generateSeqValues :: IO [Word16] generateSeqValues = do vs <- replicateM 10 (randomRIO (0x0000, 0x03FF)) return vs generateDelayValues :: IO [Word16] generateDelayValues = do vs <- replicateM 10 (randomRIO (0x0000, 0x1FFF)) return vs generateThreshValues :: IO [Word16] generateThreshValues = do vs <- replicateM 10 (randomRIO (0x0000, 0x00FF)) return vs From mgsloan at gmail.com Wed Jan 14 00:44:58 2015 From: mgsloan at gmail.com (Michael Sloan) Date: Tue, 13 Jan 2015 16:44:58 -0800 Subject: [Haskell-cafe] ParallelListComp strange behavior In-Reply-To: References: Message-ID: In the real code, a number of the lists being zipped have only one value, such as suPol, sdPol, fault_other, so the result will have at most one value. Like with zip, the length of the resulting list is the length of the shortest list. So, [(x,y) | x <- [1] | y <- [1..]] == [(1,1)]. Maybe you want normal list comprehensions with "," rather than "|"? On Tue, Jan 13, 2015 at 3:04 PM, Michael Jones wrote: > I am trying to use ParallelListComp and have code that compiles but only produces one value, but I am not clear why. > > The code is something like: > > gen :: (a -> b) -> [MyType] > gen f = [MyType (Just []) (Just c) (Just d) Nothing > | c <- f > | d <- [1,2,3,4] > > When the gen function is used with take or any other function, only one value is returned. > > Is there something here that can?t desugar properly to mzip that will still compile? > > Note I did not test this specific code, I am just writing it here to represent the different pieces of a larger piece of real code which is below. > > Mike > > ???? Real Code ???? > > > data Config = Config { onOffControl::Maybe [DEVICE_ON_OFF_CONTROL_BITS] > , seqUpPos::[Maybe ([DEVICE_SEQ_UP_POSITION_BITS], Word16)] > , seqDownPos::[Maybe ([DEVICE_SEQ_DOWN_POSITION_BITS], Word16)] > , tonTimers::[Maybe ([DEVICE_TON_TIMERS_BITS], Word16)] > , toffTimers::[Maybe ([DEVICE_TOFF_TIMERS_BITS], Word16)] > , vRange::Maybe [DEVICE_V_RANGE_BITS] > , vThresh::[Maybe (Word16, Word16)] > , rstbConfig::Maybe [DEVICE_RSTB_CONFIG_BITS] > , faultResponse::Maybe [DEVICE_FAULT_RESPONSE_BITS] > , breakpoint::Maybe ([DEVICE_BREAK_POINT_BITS], Word16) > , writeProtect::Maybe ([DEVICE_WRITE_PROTECTION_BITS], Word16) > , specialLot::Maybe Word16 > , deviceId::Maybe Word16 > , statusInfo::Maybe ([DEVICE_STATUS_INFORMATION_BITS]) > , monitorStatus::Maybe ([DEVICE_MONITOR_STATUS_BITS]) > , monitorStatusHistory::Maybe ([DEVICE_MONITOR_STATUS_HISTORY_BITS]) > , monitorBackup::Maybe ([DEVICE_MONITOR_BACKUP_BITS]) > , seqPosCount::Maybe ([DEVICE_SEQ_POSITION_COUNT_BITS], Word16) > > generateConfigs seqValues delayValues threshValues = return [Config > (Just []) -- On off > ([Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos)]) > ([Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos)]) > ([Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay)]) > ([Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay)]) > (Just [rng1, rng2, rng3, rng4, rng5, rng6]) > ([Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv)]) > (Just ([rst_en] ++ [rst_time])) > (Just ([fault_number] ++ [fault_action] ++ [fault_delay] ++ fault_other ++ [fault_count])) > (Just ([], 0)) > (Just ([], 0)) > (Just 0) > Nothing > Nothing > Nothing > Nothing > Nothing > Nothing > | suPol <- [DEVICE_seq_up_position_bits] > | suPos <- seqValues > | sdPol <- [DEVICE_seq_down_position_bits] > | sdPos <- seqValues > | tonMax <- DEVICE_ton_timers_bits > | tonDelay <- delayValues > | toffMax <- DEVICE_toff_timers_bits > | toffDelay <- delayValues > | rng1 <- DEVICE_v_range_bits1 > | rng2 <- DEVICE_v_range_bits2 > | rng3 <- DEVICE_v_range_bits3 > | rng4 <- DEVICE_v_range_bits4 > | rng5 <- DEVICE_v_range_bits5 > | rng6 <- DEVICE_v_range_bits6 > | threshOv <- threshValues > | threshUv <- threshValues > | rst_time <- DEVICE_rstb_config_bits_time > | rst_en <- DEVICE_rstb_config_bits_en > | fault_number <- DEVICE_fault_response_bits_retry_number > | fault_other <- [DEVICE_fault_response_bits_other] > | fault_count <- DEVICE_fault_response_bits_count > | fault_delay <- DEVICE_fault_response_bits_delay > | fault_action <- DEVICE_fault_response_bits_action > ] > > generateSeqValues :: IO [Word16] > generateSeqValues = do > vs <- replicateM 10 (randomRIO (0x0000, 0x03FF)) > return vs > > generateDelayValues :: IO [Word16] > generateDelayValues = do > vs <- replicateM 10 (randomRIO (0x0000, 0x1FFF)) > return vs > > > generateThreshValues :: IO [Word16] > generateThreshValues = do > vs <- replicateM 10 (randomRIO (0x0000, 0x00FF)) > return vs > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From jeffbrown.the at gmail.com Wed Jan 14 02:39:25 2015 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Tue, 13 Jan 2015 18:39:25 -0800 Subject: [Haskell-cafe] Number of widgets extant and displayed varying over time? (FRP, reactive-banana) Message-ID: Dear list, I want to write an application in which the set of widgets in existence, and the subset of them that is displayed, depends on user input. I am using reactive-banana. So far the simplest spec I have imagined for it is this: Initially there is just a text entry box and an empty (hence invisible) collection of labels. The user can do two things: enter the word "add", or enter an integer. Entering the word "add" causes a label to be added to the collection, but not displayed. The labels require no text content. Entering an integer N causes the first N labels to be displayed onscreen. The text entry box remains visible. I am totally baffled. In particular, the Behavior paradigm, though it is elegant and beautiful whenever I study it, I have no idea how to apply. Thank you, Jeff -------------- next part -------------- An HTML attachment was scrubbed... URL: From sportano at gmail.com Wed Jan 14 02:43:38 2015 From: sportano at gmail.com (Sportanova) Date: Tue, 13 Jan 2015 18:43:38 -0800 Subject: [Haskell-cafe] Deploying Scotty App to AWS In-Reply-To: References: Message-ID: There was low entropy in my docker container, but not in my aws box, so don't think entropy was the problem Couldn't figure out what was wrong, so I'm ditching Scotty tls and using a reverse proxy with ssl (probably a better idea in the first place) Thanks for the help! Sent from my iPhone > On Jan 11, 2015, at 5:26 PM, Brandon Allbery wrote: > >> On Sun, Jan 11, 2015 at 7:55 PM, Stephen Portanova wrote: >> Chris, thanks for the response! Is there anything I can do to test / work around that theory? > > See if the rng-tools or haveged packages are available. Both of these harvest additional entropy, and are invaluable for solving the entropy starvation issues with Linux in any virtual machine environment. > > If they're already installed and running, you might look for AWS-specific instructions for tuning to maximize harvested entropy. > > -- > brandon s allbery kf8nh sine nomine associates > allbery.b at gmail.com ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From apfelmus at quantentunnel.de Wed Jan 14 07:04:37 2015 From: apfelmus at quantentunnel.de (Heinrich Apfelmus) Date: Wed, 14 Jan 2015 08:04:37 +0100 Subject: [Haskell-cafe] Number of widgets extant and displayed varying over time? (FRP, reactive-banana) In-Reply-To: References: Message-ID: Jeffrey Brown wrote: > Dear list, > > I want to write an application in which the set of widgets in existence, > and the subset of them that is displayed, depends on user input. I am using > reactive-banana. So far the simplest spec I have imagined for it is this: > > Initially there is just a text entry box and an empty (hence invisible) > collection of labels. > > The user can do two things: enter the word "add", or enter an integer. > > Entering the word "add" causes a label to be added to the collection, > but not displayed. The labels require no text content. > > Entering an integer N causes the first N labels to be displayed > onscreen. The text entry box remains visible. > > I am totally baffled. In particular, the Behavior paradigm, though it is > elegant and beautiful whenever I study it, I have no idea how to apply. This looks like you need "dynamic event switching", i.e. the module `Reactive.Banana.Switch`. It's very cool, but may be more difficult to understand than the standard combinators, mainly because of the additional type parameters. To see how it works, have a look at the `BarTab.hs` example. It implements a program that is very similar to what you describe here. Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com From jeffbrown.the at gmail.com Wed Jan 14 07:33:01 2015 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Tue, 13 Jan 2015 23:33:01 -0800 Subject: [Haskell-cafe] Number of widgets extant and displayed varying over time? (FRP, reactive-banana) In-Reply-To: References: Message-ID: Thanks, Heinrich! Reactive Banana's front page on Hackage [1] indicates that Reactive.Banana.Switch offers "no garbage collection for events that are created dynamically". Does that mean one has to collect the garbage oneself, or does it mean that garbage cannot be collected at all? My eventual goal is to write a mindmap editor, ala Freeplane. There might never be more than fifty or so frames of text on display at any one time, but in a single session I can easily imagine drawing hundreds of thousands of them. (For that estimate I am assuming a single line of text in the model would require a new frame each time it is redisplayed; if instead a frame could persist invisibly and be redrawn later, most sessions would, I imagine, involve fewer than five thousand frames -- but even then it's not obvious to me that I could forego garbage collection.) [1] https://hackage.haskell.org/package/reactive-banana On Tue, Jan 13, 2015 at 11:04 PM, Heinrich Apfelmus < apfelmus at quantentunnel.de> wrote: > Jeffrey Brown wrote: > >> Dear list, >> >> I want to write an application in which the set of widgets in existence, >> and the subset of them that is displayed, depends on user input. I am >> using >> reactive-banana. So far the simplest spec I have imagined for it is this: >> >> Initially there is just a text entry box and an empty (hence >> invisible) >> collection of labels. >> >> The user can do two things: enter the word "add", or enter an integer. >> >> Entering the word "add" causes a label to be added to the collection, >> but not displayed. The labels require no text content. >> >> Entering an integer N causes the first N labels to be displayed >> onscreen. The text entry box remains visible. >> >> I am totally baffled. In particular, the Behavior paradigm, though it is >> elegant and beautiful whenever I study it, I have no idea how to apply. >> > > This looks like you need "dynamic event switching", i.e. the module > `Reactive.Banana.Switch`. It's very cool, but may be more difficult to > understand than the standard combinators, mainly because of the additional > type parameters. > > To see how it works, have a look at the `BarTab.hs` example. It implements > a program that is very similar to what you describe here. > > > Best regards, > Heinrich Apfelmus > > -- > http://apfelmus.nfshost.com > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg at okmij.org Wed Jan 14 08:47:52 2015 From: oleg at okmij.org (oleg at okmij.org) Date: Wed, 14 Jan 2015 03:47:52 -0500 (EST) Subject: [Haskell-cafe] working my way through Data.Type.Equality...my head hurts... Message-ID: <20150114084752.07619C3847@www1.g3.pair.com> Richard Eisenberg wrote: > `~` is simply equality on types. The constraint `a ~ b` means that `a` > is the same type as `b`. We could have spelled it `=` if that weren't > used elsewhere. Before `~` was added to GHC, it might have been > implemented like this: > class Equals a b | a -> b, b -> a > instance Equals x x > -- no other instances! Actually, `~' has been implemented, back in 2004, and the implementation quite a bit more involved than the above (although still taking a couple of lines). The `~' constrain was called TypeCast back then, and there is a page about it explaining the benefits and peculiarities of the implementation. http://okmij.org/ftp/Haskell/typecast.html Perhaps the many examples of TypeCast make it less mysterious. From mike at proclivis.com Wed Jan 14 20:10:30 2015 From: mike at proclivis.com (Michael Jones) Date: Wed, 14 Jan 2015 13:10:30 -0700 Subject: [Haskell-cafe] ParallelListComp strange behavior In-Reply-To: References: Message-ID: If one of the values in the constructor is a constant value, and not in the generator, is it excluded from the zip or is it also zipping that parameter too? On Jan 13, 2015, at 5:44 PM, Michael Sloan wrote: > In the real code, a number of the lists being zipped have only one > value, such as suPol, sdPol, fault_other, so the result will have at > most one value. Like with zip, the length of the resulting list is > the length of the shortest list. So, [(x,y) | x <- [1] | y <- [1..]] > == [(1,1)]. Maybe you want normal list comprehensions with "," rather > than "|"? > > On Tue, Jan 13, 2015 at 3:04 PM, Michael Jones wrote: >> I am trying to use ParallelListComp and have code that compiles but only produces one value, but I am not clear why. >> >> The code is something like: >> >> gen :: (a -> b) -> [MyType] >> gen f = [MyType (Just []) (Just c) (Just d) Nothing >> | c <- f >> | d <- [1,2,3,4] >> >> When the gen function is used with take or any other function, only one value is returned. >> >> Is there something here that can?t desugar properly to mzip that will still compile? >> >> Note I did not test this specific code, I am just writing it here to represent the different pieces of a larger piece of real code which is below. >> >> Mike >> >> ???? Real Code ???? >> >> >> data Config = Config { onOffControl::Maybe [DEVICE_ON_OFF_CONTROL_BITS] >> , seqUpPos::[Maybe ([DEVICE_SEQ_UP_POSITION_BITS], Word16)] >> , seqDownPos::[Maybe ([DEVICE_SEQ_DOWN_POSITION_BITS], Word16)] >> , tonTimers::[Maybe ([DEVICE_TON_TIMERS_BITS], Word16)] >> , toffTimers::[Maybe ([DEVICE_TOFF_TIMERS_BITS], Word16)] >> , vRange::Maybe [DEVICE_V_RANGE_BITS] >> , vThresh::[Maybe (Word16, Word16)] >> , rstbConfig::Maybe [DEVICE_RSTB_CONFIG_BITS] >> , faultResponse::Maybe [DEVICE_FAULT_RESPONSE_BITS] >> , breakpoint::Maybe ([DEVICE_BREAK_POINT_BITS], Word16) >> , writeProtect::Maybe ([DEVICE_WRITE_PROTECTION_BITS], Word16) >> , specialLot::Maybe Word16 >> , deviceId::Maybe Word16 >> , statusInfo::Maybe ([DEVICE_STATUS_INFORMATION_BITS]) >> , monitorStatus::Maybe ([DEVICE_MONITOR_STATUS_BITS]) >> , monitorStatusHistory::Maybe ([DEVICE_MONITOR_STATUS_HISTORY_BITS]) >> , monitorBackup::Maybe ([DEVICE_MONITOR_BACKUP_BITS]) >> , seqPosCount::Maybe ([DEVICE_SEQ_POSITION_COUNT_BITS], Word16) >> >> generateConfigs seqValues delayValues threshValues = return [Config >> (Just []) -- On off >> ([Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos)]) >> ([Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos)]) >> ([Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay)]) >> ([Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay)]) >> (Just [rng1, rng2, rng3, rng4, rng5, rng6]) >> ([Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv)]) >> (Just ([rst_en] ++ [rst_time])) >> (Just ([fault_number] ++ [fault_action] ++ [fault_delay] ++ fault_other ++ [fault_count])) >> (Just ([], 0)) >> (Just ([], 0)) >> (Just 0) >> Nothing >> Nothing >> Nothing >> Nothing >> Nothing >> Nothing >> | suPol <- [DEVICE_seq_up_position_bits] >> | suPos <- seqValues >> | sdPol <- [DEVICE_seq_down_position_bits] >> | sdPos <- seqValues >> | tonMax <- DEVICE_ton_timers_bits >> | tonDelay <- delayValues >> | toffMax <- DEVICE_toff_timers_bits >> | toffDelay <- delayValues >> | rng1 <- DEVICE_v_range_bits1 >> | rng2 <- DEVICE_v_range_bits2 >> | rng3 <- DEVICE_v_range_bits3 >> | rng4 <- DEVICE_v_range_bits4 >> | rng5 <- DEVICE_v_range_bits5 >> | rng6 <- DEVICE_v_range_bits6 >> | threshOv <- threshValues >> | threshUv <- threshValues >> | rst_time <- DEVICE_rstb_config_bits_time >> | rst_en <- DEVICE_rstb_config_bits_en >> | fault_number <- DEVICE_fault_response_bits_retry_number >> | fault_other <- [DEVICE_fault_response_bits_other] >> | fault_count <- DEVICE_fault_response_bits_count >> | fault_delay <- DEVICE_fault_response_bits_delay >> | fault_action <- DEVICE_fault_response_bits_action >> ] >> >> generateSeqValues :: IO [Word16] >> generateSeqValues = do >> vs <- replicateM 10 (randomRIO (0x0000, 0x03FF)) >> return vs >> >> generateDelayValues :: IO [Word16] >> generateDelayValues = do >> vs <- replicateM 10 (randomRIO (0x0000, 0x1FFF)) >> return vs >> >> >> generateThreshValues :: IO [Word16] >> generateThreshValues = do >> vs <- replicateM 10 (randomRIO (0x0000, 0x00FF)) >> return vs >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe From mike at proclivis.com Wed Jan 14 21:36:47 2015 From: mike at proclivis.com (Michael Jones) Date: Wed, 14 Jan 2015 14:36:47 -0700 Subject: [Haskell-cafe] ParallelListComp strange behavior In-Reply-To: References: Message-ID: <8EA3655C-0C20-4C84-82E3-D0B52C6B357D@proclivis.com> I figured it out. Constant values work fine when not in the generator. My main problem was a more subtle short list. The obvious ones were added when trying to test behavior, as they were originally just constant values in the constructor. When I removed them all, I found an offending generator that was not so obvious. Thanks On Jan 14, 2015, at 1:10 PM, Michael Jones wrote: > If one of the values in the constructor is a constant value, and not in the generator, is it excluded from the zip or is it also zipping that parameter too? > > > On Jan 13, 2015, at 5:44 PM, Michael Sloan wrote: > >> In the real code, a number of the lists being zipped have only one >> value, such as suPol, sdPol, fault_other, so the result will have at >> most one value. Like with zip, the length of the resulting list is >> the length of the shortest list. So, [(x,y) | x <- [1] | y <- [1..]] >> == [(1,1)]. Maybe you want normal list comprehensions with "," rather >> than "|"? >> >> On Tue, Jan 13, 2015 at 3:04 PM, Michael Jones wrote: >>> I am trying to use ParallelListComp and have code that compiles but only produces one value, but I am not clear why. >>> >>> The code is something like: >>> >>> gen :: (a -> b) -> [MyType] >>> gen f = [MyType (Just []) (Just c) (Just d) Nothing >>> | c <- f >>> | d <- [1,2,3,4] >>> >>> When the gen function is used with take or any other function, only one value is returned. >>> >>> Is there something here that can?t desugar properly to mzip that will still compile? >>> >>> Note I did not test this specific code, I am just writing it here to represent the different pieces of a larger piece of real code which is below. >>> >>> Mike >>> >>> ???? Real Code ???? >>> >>> >>> data Config = Config { onOffControl::Maybe [DEVICE_ON_OFF_CONTROL_BITS] >>> , seqUpPos::[Maybe ([DEVICE_SEQ_UP_POSITION_BITS], Word16)] >>> , seqDownPos::[Maybe ([DEVICE_SEQ_DOWN_POSITION_BITS], Word16)] >>> , tonTimers::[Maybe ([DEVICE_TON_TIMERS_BITS], Word16)] >>> , toffTimers::[Maybe ([DEVICE_TOFF_TIMERS_BITS], Word16)] >>> , vRange::Maybe [DEVICE_V_RANGE_BITS] >>> , vThresh::[Maybe (Word16, Word16)] >>> , rstbConfig::Maybe [DEVICE_RSTB_CONFIG_BITS] >>> , faultResponse::Maybe [DEVICE_FAULT_RESPONSE_BITS] >>> , breakpoint::Maybe ([DEVICE_BREAK_POINT_BITS], Word16) >>> , writeProtect::Maybe ([DEVICE_WRITE_PROTECTION_BITS], Word16) >>> , specialLot::Maybe Word16 >>> , deviceId::Maybe Word16 >>> , statusInfo::Maybe ([DEVICE_STATUS_INFORMATION_BITS]) >>> , monitorStatus::Maybe ([DEVICE_MONITOR_STATUS_BITS]) >>> , monitorStatusHistory::Maybe ([DEVICE_MONITOR_STATUS_HISTORY_BITS]) >>> , monitorBackup::Maybe ([DEVICE_MONITOR_BACKUP_BITS]) >>> , seqPosCount::Maybe ([DEVICE_SEQ_POSITION_COUNT_BITS], Word16) >>> >>> generateConfigs seqValues delayValues threshValues = return [Config >>> (Just []) -- On off >>> ([Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos)]) >>> ([Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos)]) >>> ([Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay)]) >>> ([Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay)]) >>> (Just [rng1, rng2, rng3, rng4, rng5, rng6]) >>> ([Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv)]) >>> (Just ([rst_en] ++ [rst_time])) >>> (Just ([fault_number] ++ [fault_action] ++ [fault_delay] ++ fault_other ++ [fault_count])) >>> (Just ([], 0)) >>> (Just ([], 0)) >>> (Just 0) >>> Nothing >>> Nothing >>> Nothing >>> Nothing >>> Nothing >>> Nothing >>> | suPol <- [DEVICE_seq_up_position_bits] >>> | suPos <- seqValues >>> | sdPol <- [DEVICE_seq_down_position_bits] >>> | sdPos <- seqValues >>> | tonMax <- DEVICE_ton_timers_bits >>> | tonDelay <- delayValues >>> | toffMax <- DEVICE_toff_timers_bits >>> | toffDelay <- delayValues >>> | rng1 <- DEVICE_v_range_bits1 >>> | rng2 <- DEVICE_v_range_bits2 >>> | rng3 <- DEVICE_v_range_bits3 >>> | rng4 <- DEVICE_v_range_bits4 >>> | rng5 <- DEVICE_v_range_bits5 >>> | rng6 <- DEVICE_v_range_bits6 >>> | threshOv <- threshValues >>> | threshUv <- threshValues >>> | rst_time <- DEVICE_rstb_config_bits_time >>> | rst_en <- DEVICE_rstb_config_bits_en >>> | fault_number <- DEVICE_fault_response_bits_retry_number >>> | fault_other <- [DEVICE_fault_response_bits_other] >>> | fault_count <- DEVICE_fault_response_bits_count >>> | fault_delay <- DEVICE_fault_response_bits_delay >>> | fault_action <- DEVICE_fault_response_bits_action >>> ] >>> >>> generateSeqValues :: IO [Word16] >>> generateSeqValues = do >>> vs <- replicateM 10 (randomRIO (0x0000, 0x03FF)) >>> return vs >>> >>> generateDelayValues :: IO [Word16] >>> generateDelayValues = do >>> vs <- replicateM 10 (randomRIO (0x0000, 0x1FFF)) >>> return vs >>> >>> >>> generateThreshValues :: IO [Word16] >>> generateThreshValues = do >>> vs <- replicateM 10 (randomRIO (0x0000, 0x00FF)) >>> return vs >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From mgsloan at gmail.com Wed Jan 14 22:24:47 2015 From: mgsloan at gmail.com (Michael Sloan) Date: Wed, 14 Jan 2015 14:24:47 -0800 Subject: [Haskell-cafe] ParallelListComp strange behavior In-Reply-To: <8EA3655C-0C20-4C84-82E3-D0B52C6B357D@proclivis.com> References: <8EA3655C-0C20-4C84-82E3-D0B52C6B357D@proclivis.com> Message-ID: Welcome! The equivalent of a "constant value" for a list being zipped is (repeat x). For example, that's the behavior of the 'pure' for Control.Applicative.ZipList. On Wed, Jan 14, 2015 at 1:36 PM, Michael Jones wrote: > I figured it out. Constant values work fine when not in the generator. > > My main problem was a more subtle short list. The obvious ones were added when trying to test behavior, as they were originally just constant values in the constructor. When I removed them all, I found an offending generator that was not so obvious. > > Thanks > > On Jan 14, 2015, at 1:10 PM, Michael Jones wrote: > >> If one of the values in the constructor is a constant value, and not in the generator, is it excluded from the zip or is it also zipping that parameter too? >> >> >> On Jan 13, 2015, at 5:44 PM, Michael Sloan wrote: >> >>> In the real code, a number of the lists being zipped have only one >>> value, such as suPol, sdPol, fault_other, so the result will have at >>> most one value. Like with zip, the length of the resulting list is >>> the length of the shortest list. So, [(x,y) | x <- [1] | y <- [1..]] >>> == [(1,1)]. Maybe you want normal list comprehensions with "," rather >>> than "|"? >>> >>> On Tue, Jan 13, 2015 at 3:04 PM, Michael Jones wrote: >>>> I am trying to use ParallelListComp and have code that compiles but only produces one value, but I am not clear why. >>>> >>>> The code is something like: >>>> >>>> gen :: (a -> b) -> [MyType] >>>> gen f = [MyType (Just []) (Just c) (Just d) Nothing >>>> | c <- f >>>> | d <- [1,2,3,4] >>>> >>>> When the gen function is used with take or any other function, only one value is returned. >>>> >>>> Is there something here that can?t desugar properly to mzip that will still compile? >>>> >>>> Note I did not test this specific code, I am just writing it here to represent the different pieces of a larger piece of real code which is below. >>>> >>>> Mike >>>> >>>> ???? Real Code ???? >>>> >>>> >>>> data Config = Config { onOffControl::Maybe [DEVICE_ON_OFF_CONTROL_BITS] >>>> , seqUpPos::[Maybe ([DEVICE_SEQ_UP_POSITION_BITS], Word16)] >>>> , seqDownPos::[Maybe ([DEVICE_SEQ_DOWN_POSITION_BITS], Word16)] >>>> , tonTimers::[Maybe ([DEVICE_TON_TIMERS_BITS], Word16)] >>>> , toffTimers::[Maybe ([DEVICE_TOFF_TIMERS_BITS], Word16)] >>>> , vRange::Maybe [DEVICE_V_RANGE_BITS] >>>> , vThresh::[Maybe (Word16, Word16)] >>>> , rstbConfig::Maybe [DEVICE_RSTB_CONFIG_BITS] >>>> , faultResponse::Maybe [DEVICE_FAULT_RESPONSE_BITS] >>>> , breakpoint::Maybe ([DEVICE_BREAK_POINT_BITS], Word16) >>>> , writeProtect::Maybe ([DEVICE_WRITE_PROTECTION_BITS], Word16) >>>> , specialLot::Maybe Word16 >>>> , deviceId::Maybe Word16 >>>> , statusInfo::Maybe ([DEVICE_STATUS_INFORMATION_BITS]) >>>> , monitorStatus::Maybe ([DEVICE_MONITOR_STATUS_BITS]) >>>> , monitorStatusHistory::Maybe ([DEVICE_MONITOR_STATUS_HISTORY_BITS]) >>>> , monitorBackup::Maybe ([DEVICE_MONITOR_BACKUP_BITS]) >>>> , seqPosCount::Maybe ([DEVICE_SEQ_POSITION_COUNT_BITS], Word16) >>>> >>>> generateConfigs seqValues delayValues threshValues = return [Config >>>> (Just []) -- On off >>>> ([Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos),Just (suPol, suPos)]) >>>> ([Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos),Just (sdPol, sdPos)]) >>>> ([Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay),Just ([tonMax], tonDelay)]) >>>> ([Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay),Just ([toffMax], toffDelay)]) >>>> (Just [rng1, rng2, rng3, rng4, rng5, rng6]) >>>> ([Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv),Just (threshOv, threshUv)]) >>>> (Just ([rst_en] ++ [rst_time])) >>>> (Just ([fault_number] ++ [fault_action] ++ [fault_delay] ++ fault_other ++ [fault_count])) >>>> (Just ([], 0)) >>>> (Just ([], 0)) >>>> (Just 0) >>>> Nothing >>>> Nothing >>>> Nothing >>>> Nothing >>>> Nothing >>>> Nothing >>>> | suPol <- [DEVICE_seq_up_position_bits] >>>> | suPos <- seqValues >>>> | sdPol <- [DEVICE_seq_down_position_bits] >>>> | sdPos <- seqValues >>>> | tonMax <- DEVICE_ton_timers_bits >>>> | tonDelay <- delayValues >>>> | toffMax <- DEVICE_toff_timers_bits >>>> | toffDelay <- delayValues >>>> | rng1 <- DEVICE_v_range_bits1 >>>> | rng2 <- DEVICE_v_range_bits2 >>>> | rng3 <- DEVICE_v_range_bits3 >>>> | rng4 <- DEVICE_v_range_bits4 >>>> | rng5 <- DEVICE_v_range_bits5 >>>> | rng6 <- DEVICE_v_range_bits6 >>>> | threshOv <- threshValues >>>> | threshUv <- threshValues >>>> | rst_time <- DEVICE_rstb_config_bits_time >>>> | rst_en <- DEVICE_rstb_config_bits_en >>>> | fault_number <- DEVICE_fault_response_bits_retry_number >>>> | fault_other <- [DEVICE_fault_response_bits_other] >>>> | fault_count <- DEVICE_fault_response_bits_count >>>> | fault_delay <- DEVICE_fault_response_bits_delay >>>> | fault_action <- DEVICE_fault_response_bits_action >>>> ] >>>> >>>> generateSeqValues :: IO [Word16] >>>> generateSeqValues = do >>>> vs <- replicateM 10 (randomRIO (0x0000, 0x03FF)) >>>> return vs >>>> >>>> generateDelayValues :: IO [Word16] >>>> generateDelayValues = do >>>> vs <- replicateM 10 (randomRIO (0x0000, 0x1FFF)) >>>> return vs >>>> >>>> >>>> generateThreshValues :: IO [Word16] >>>> generateThreshValues = do >>>> vs <- replicateM 10 (randomRIO (0x0000, 0x00FF)) >>>> return vs >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > From oleg at okmij.org Thu Jan 15 06:03:13 2015 From: oleg at okmij.org (oleg at okmij.org) Date: Thu, 15 Jan 2015 01:03:13 -0500 (EST) Subject: [Haskell-cafe] uu-parsinglib - Greedy Parser In-Reply-To: <21ACA907-DCEA-4E3E-A424-8E865F4A0373@swierstra.net> Message-ID: <20150115060313.D42B8C38AD@www1.g3.pair.com> Marco Vassena wrote: > The bigger picture is that I am trying to figure out what > are the core constructs needed to define a parser, therefore I want to > have a rather abstract interface. In my set of core constructs there are: > <$> : (a -> b) -> f a -> f b > <*> : f (a -> b) -> f a -> f b > <|> : f a -> f a -> f a -- (symmetric choice) > pure : a -> f a > fail : f a > pToken : f Char > > Is it possible to define a parser that applies the longest > matching rule using these constructs only? No, these are not sufficient. Longest-matching rule (aka maximal munch) is defined as applying a parser for as long as it succeeds. Therefore, we need a way to determine if a parser succeeded: we need what is called a (monadic) reflection. In simpler words, we need an operation like the soft-cut in Prolog. It can be defined in terms of a primitive called `msplit', described in the LogicT paper: http://okmij.org/ftp/Computation/monads.html#LogicT The following article talks about maximal munch in more detail, in terms of logic programming: http://okmij.org/ftp/kakuritu/logic-programming.html#many From dhrosa at gmail.com Thu Jan 15 03:46:00 2015 From: dhrosa at gmail.com (Diony Rosa) Date: Wed, 15 Jan 2015 03:46:00 +0000 Subject: [Haskell-cafe] =?iso-8859-1?q?1/15/2015_3=3A46=3A00_PM?= Message-ID: <3D8E23BAC431F6EADED33A1DAF374FAF@mail.bankriau.co.id> http://www.1367.co.nz/basjaupc/pebrbhpjthzcrumhnityftkmrmxbjau.myfduxbsyxonphgllsqjbht Diony Rosa 1/15/2015 3:46:00 PM -------------- next part -------------- An HTML attachment was scrubbed... URL: From prfels at googlemail.com Thu Jan 15 20:36:57 2015 From: prfels at googlemail.com (Peter Reiner Fels) Date: Thu, 15 Jan 2015 21:36:57 +0100 Subject: [Haskell-cafe] Undefined symbols when trying to use SDL-mixer Message-ID: I'm trying to use SDL-mixer v0.6.1. When I add a dependency to my cabal file and run cabal repl I get the following error: Loading package SDL-mixer-0.6.1 ... : can't load .so/.DLL for: /home/prf/haskell/link-problem/.cabal-sandbox/lib/x86_64-linux-ghc-7.8.3/SDL-mi xer-0.6.1/libHSSDL-mixer-0.6.1-ghc7.8.3.so (/home/prf/haskell/link-problem/.cab al-sandbox/lib/x86_64-linux-ghc-7.8.3/SDL-mixer-0.6.1/libHSSDL-mixer-0.6.1-ghc7 .8.3.so: undefined symbol: Mix_FreeChunk) I can see these undefined symbols when I run: nm -D SDL-mixer-0.6.1/libHSSDL-mixer-0.6.1-ghc7.8.3.so | grep Free U Mix_FreeChunk U Mix_FreeMusic Running ldd on this file and grepping for SDL gives libHSSDL-0.6.5-ghc7.8.3.so => /home/prf/haskell/link-problem/.cabal-sandbox/lib /x86_64-linux-ghc-7.8.3/SDL-0.6.5/libHSSDL-0.6.5-ghc7.8.3.so (0x00007fb20b30600 0) libSDL-1.2.so.0 => /usr/lib64/libSDL-1.2.so.0 (0x00007fb20a232000) It seems like a dependency to /usr/lib64/libSDL_mixer.so is missing. Line 1815 of SDL-mixer-0.6.1/configure contains the following definition of SDL_LIBS: SDL_LIBS="-L`$SDL_CONFIG --prefix`/lib -lSDL_mixer" This refers to the 32 bit lib directory, but I'm on a 64 bit system. I unpacked SDL-mixer and changed this line to refer to the 64 bit lib directory. Next I recreated my cabal sandbox from scratch and added the patched version of SDL-mixer as a dependency. When I run cabal repl again I get the same error as mentioned above. What am I doing wrong? How do I get SDL-mixer to build against /usr/lib64/libSDL_mixer.so? Thanks, Peter -------------- next part -------------- An HTML attachment was scrubbed... URL: From hurroz at gmail.com Fri Jan 16 16:48:06 2015 From: hurroz at gmail.com (Hector Urroz) Date: Fri, 16 Jan 2015 09:48:06 -0700 Subject: [Haskell-cafe] haskell.org slow Message-ID: <429784BD-318F-4317-A23A-79D8CBF7F4D4@gmail.com> Anyone know when haskell.org will be usable again? Page loads take 20+ seconds. Info at https://status.haskell.org indicates there's a DB problem, but there's no ETA and performance has been bad for over 10 days. -------------- next part -------------- An HTML attachment was scrubbed... URL: From apfelmus at quantentunnel.de Fri Jan 16 17:01:51 2015 From: apfelmus at quantentunnel.de (Heinrich Apfelmus) Date: Fri, 16 Jan 2015 18:01:51 +0100 Subject: [Haskell-cafe] Number of widgets extant and displayed varying over time? (FRP, reactive-banana) In-Reply-To: References: Message-ID: Dear Jeffrey, > Does that mean one has to collect the garbage oneself, or does it > mean that garbage cannot be collected at all? At the moment, it means that garbage cannot be collected at all. This will change in the next version, reactive-banana-0.9. (There is no anticipated release date yet, though.) > There might never be more than fifty or so frames of text on display > at any one time, but in a single session I can easily imagine drawing > hundreds of thousands of them. I'm not quite sure what you mean by "frame". If it's a text whose position can move, then you can probably model it by a Behavior (Position, String) The, "moving text block" is the smallest entity that you would have to garbage collect, and I guess there are no more than ~300 of them active over the lifetime of a program. If you create a new Behavior each time the text is moved, then things become more resource intensive, of course. Then, it would be necessary to garbage collect a Behavior each time that a text is moved, these are probably proportional to the number of mouse clicks that the user makes over the lifetime of the program. Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com Jeffrey Brown wrote: > Thanks, Heinrich! > > Reactive Banana's front page on Hackage [1] indicates that > Reactive.Banana.Switch offers "no garbage collection for events that are > created dynamically". Does that mean one has to collect the garbage > oneself, or does it mean that garbage cannot be collected at all? > > My eventual goal is to write a mindmap editor, ala Freeplane. There might > never be more than fifty or so frames of text on display at any one time, > but in a single session I can easily imagine drawing hundreds of thousands > of them. (For that estimate I am assuming a single line of text in the > model would require a new frame each time it is redisplayed; if instead a > frame could persist invisibly and be redrawn later, most sessions would, I > imagine, involve fewer than five thousand frames -- but even then it's not > obvious to me that I could forego garbage collection.) > > [1] https://hackage.haskell.org/package/reactive-banana > > On Tue, Jan 13, 2015 at 11:04 PM, Heinrich Apfelmus < > apfelmus at quantentunnel.de> wrote: > >> Jeffrey Brown wrote: >> >>> Dear list, >>> >>> I want to write an application in which the set of widgets in existence, >>> and the subset of them that is displayed, depends on user input. I am >>> using >>> reactive-banana. So far the simplest spec I have imagined for it is this: >>> >>> Initially there is just a text entry box and an empty (hence >>> invisible) >>> collection of labels. >>> >>> The user can do two things: enter the word "add", or enter an integer. >>> >>> Entering the word "add" causes a label to be added to the collection, >>> but not displayed. The labels require no text content. >>> >>> Entering an integer N causes the first N labels to be displayed >>> onscreen. The text entry box remains visible. >>> >>> I am totally baffled. In particular, the Behavior paradigm, though it is >>> elegant and beautiful whenever I study it, I have no idea how to apply. >>> >> This looks like you need "dynamic event switching", i.e. the module >> `Reactive.Banana.Switch`. It's very cool, but may be more difficult to >> understand than the standard combinators, mainly because of the additional >> type parameters. >> >> To see how it works, have a look at the `BarTab.hs` example. It implements >> a program that is very similar to what you describe here. >> >> >> Best regards, >> Heinrich Apfelmus >> >> -- >> http://apfelmus.nfshost.com From johan.tibell at gmail.com Fri Jan 16 22:26:21 2015 From: johan.tibell at gmail.com (Johan Tibell) Date: Fri, 16 Jan 2015 23:26:21 +0100 Subject: [Haskell-cafe] haskell.org slow In-Reply-To: <429784BD-318F-4317-A23A-79D8CBF7F4D4@gmail.com> References: <429784BD-318F-4317-A23A-79D8CBF7F4D4@gmail.com> Message-ID: On Jan 16, 2015 5:48 PM, "Hector Urroz" wrote: > Anyone know when haskell.org will be usable again? Page loads take 20+ > seconds. Info at https://status.haskell.org indicates there's a DB > problem, but there's no ETA and performance has been bad for over 10 days. > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From iu.biryukov at gmail.com Sat Jan 17 13:19:49 2015 From: iu.biryukov at gmail.com (=?UTF-8?B?0JjQu9GM0Y8g0JHQuNGA0Y7QutC+0LI=?=) Date: Sat, 17 Jan 2015 17:19:49 +0400 Subject: [Haskell-cafe] Code-completion problem with emacs, ghc-mod and auto-complete Message-ID: Hi, Cafe! I'm struggling to configure my emacs for haskell development with ghc-mod and auto-complete. It works well for the most part, but I've run into the issue when completing qualified names. In the following example I don't get any completion after BS: module Playground where import qualified Data.ByteString.Lazy as BL doWork :: BL.By -- no completion after dot Completion for unqualified names and module name in imports works just fine. Maybe someone has run into this issue before? My .emacs: (ac-config-default) (auto-complete-mode t) (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation) (autoload 'ghc-init "ghc" nil t) (add-hook 'haskell-mode-hook (lambda () (ghc-init))) (defun my-ac-haskell-mode () (setq ac-sources (append ac-sources '(ac-source-ghc-mod)))) (add-hook 'haskell-mode-hook 'my-ac-haskell-mode) (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode) (add-hook 'haskell-mode-hook 'turn-on-haskell-indent) (ac-define-source ghc-mod '((depends ghc) (candidates . ghc-select-completion-symbol) (symbol . "s") (cache))) -- Regards, Ilya Biryukov. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hasufell at posteo.de Sat Jan 17 19:06:16 2015 From: hasufell at posteo.de (Julian Ospald) Date: Sat, 17 Jan 2015 19:06:16 +0000 Subject: [Haskell-cafe] Type synonyms considered harmful? Message-ID: <54BAB2A8.1070504@posteo.de> Hi, I've recently had a discussion about type synonyms and when to use them in haskell. On the one hand, they make reading type signatures easier and tell you what is meant, not just what is inside. On the other hand they also sort of hide what is inside, although you will probably need to know exactly that when using them. This might make reading code for new collaborators more difficult if they have to memorize all type synonyms first. So there are basically a few questions: * What do you think is a good policy for when and how to use them? Or would you say just not use them at all and put equivalent information in parameter documentation? * What are the upsides, downsides, pitfalls and also alternatives? (for completeness, also since https://www.haskell.org/haskellwiki/Type_synonym is a bit sparse) * Can we do something to improve the downsides? Or is there already something? (e.g. editor/IDE that can tell me the underlying type, error messages etc.) -- Regards, Julian Ospald From mboes at tweag.net Sat Jan 17 20:07:03 2015 From: mboes at tweag.net (Mathieu Boespflug) Date: Sat, 17 Jan 2015 21:07:03 +0100 Subject: [Haskell-cafe] Type synonyms considered harmful? In-Reply-To: <54BAB2A8.1070504@posteo.de> References: <54BAB2A8.1070504@posteo.de> Message-ID: I tend to reserve type synonyms exclusively for *abbreviating* types, for example when they end up being long and unwieldy. Since this is seldom necessary, I seldom use type synonyms. Others (ab?)use type synonyms to convey semantic information, e.g. type Age = Int However, if the need for naming things separately at the type level really is pressing, then one could argue that for that you would be better served introducing a newtype anyways. IOW, my rule of thumb is: type synonyms only as abbreviations, newtypes for semantically distinct entities, neither when the overhead of a newtype wouldn't pay its own way in terms of either static checking or clarity. Best, Mathieu On 17 January 2015 at 20:06, Julian Ospald wrote: > Hi, > > I've recently had a discussion about type synonyms and when to use them > in haskell. > > On the one hand, they make reading type signatures easier and tell you > what is meant, not just what is inside. On the other hand they also sort > of hide what is inside, although you will probably need to know exactly > that when using them. This might make reading code for new collaborators > more difficult if they have to memorize all type synonyms first. > > So there are basically a few questions: > * What do you think is a good policy for when and how to use them? Or > would you say just not use them at all and put equivalent information in > parameter documentation? > * What are the upsides, downsides, pitfalls and also alternatives? (for > completeness, also since > https://www.haskell.org/haskellwiki/Type_synonym is a bit sparse) > * Can we do something to improve the downsides? Or is there already > something? (e.g. editor/IDE that can tell me the underlying type, error > messages etc.) > > > -- > Regards, > Julian Ospald > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From acowley at seas.upenn.edu Sat Jan 17 21:16:05 2015 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Sat, 17 Jan 2015 16:16:05 -0500 Subject: [Haskell-cafe] Code-completion problem with emacs, ghc-mod and auto-complete In-Reply-To: References: Message-ID: <78F8A263-E3C8-43BB-B821-CD7B1C27B407@seas.upenn.edu> > On Jan 17, 2015, at 8:19 AM, ???? ??????? wrote: > > Hi, Cafe! > > I'm struggling to configure my emacs for haskell development with ghc-mod and auto-complete. It works well for the most part, but I've run into the issue when completing qualified names. In the following example I don't get any completion after BS: > > module Playground where > > import qualified Data.ByteString.Lazy as BL > > doWork :: BL.By -- no completion after dot > > Completion for unqualified names and module name in imports works just fine. > Maybe someone has run into this issue before? > Completion after the dot is provided by company-ghc, so you'd want to setup company rather than autocomplete. Anthony > My .emacs: > (ac-config-default) > (auto-complete-mode t) > > (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation) > > (autoload 'ghc-init "ghc" nil t) > (add-hook 'haskell-mode-hook (lambda () (ghc-init))) > > (defun my-ac-haskell-mode () > (setq ac-sources (append ac-sources '(ac-source-ghc-mod)))) > > (add-hook 'haskell-mode-hook 'my-ac-haskell-mode) > (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode) > (add-hook 'haskell-mode-hook 'turn-on-haskell-indent) > > (ac-define-source ghc-mod > '((depends ghc) > (candidates . ghc-select-completion-symbol) > (symbol . "s") > (cache))) > > -- > Regards, Ilya Biryukov. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From mike at proclivis.com Sun Jan 18 01:17:41 2015 From: mike at proclivis.com (Michael Jones) Date: Sat, 17 Jan 2015 18:17:41 -0700 Subject: [Haskell-cafe] enable-executable-profiling failing with cabal 1.22 Message-ID: <00E3ED3C-5DAB-4E91-B3F4-6EA4856A9811@proclivis.com> Using cabal 1.22 for some reason does not like ?enable-executable-profiling. I am working on a rebuilt machine that had 1.18 from the distribution, with 1.22 installed afterwards. I found a little info on people having this problem, but I failed to fix the problem. Note than the library profiling option is accepted. Only the executable fails. Is there any know way to start with platform 2014 with GHC 7.8.3 and install cabal 1.22 and can use this option? From ivan.miljenovic at gmail.com Sun Jan 18 10:56:31 2015 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Sun, 18 Jan 2015 21:56:31 +1100 Subject: [Haskell-cafe] StateT and ContT Message-ID: In the transformers library, there are two implementations for callCC for use with StateT (both lazy and strict) [1,2], the second of which is documented to not satisfy the laws of a monad transformer. [1]: http://hackage.haskell.org/package/transformers-0.4.2.0/docs/Control-Monad-Trans-State-Lazy.html#v:liftCallCC [2]: http://hackage.haskell.org/package/transformers-0.4.2.0/docs/Control-Monad-Trans-State-Lazy.html#v:liftCallCC-39- However, in mtl the MonadCont class [3] uses the second definition for the StateT instance. Is there a good reason for this, or just to match the behaviour of pre-transformers mtl [4] ? [3]: http://hackage.haskell.org/package/mtl-2.2.1/docs/Control-Monad-Cont-Class.html [4]: http://hackage.haskell.org/package/mtl-1.1.1.1/docs/src/Control-Monad-State-Lazy.html (I did raise an issue for this on mtl's Github issue tracker, but it hasn't had any responses for two months.) -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From ttuegel at gmail.com Sun Jan 18 15:03:38 2015 From: ttuegel at gmail.com (Thomas Tuegel) Date: Sun, 18 Jan 2015 09:03:38 -0600 Subject: [Haskell-cafe] enable-executable-profiling failing with cabal 1.22 In-Reply-To: <00E3ED3C-5DAB-4E91-B3F4-6EA4856A9811@proclivis.com> References: <00E3ED3C-5DAB-4E91-B3F4-6EA4856A9811@proclivis.com> Message-ID: On Sat, Jan 17, 2015 at 7:17 PM, Michael Jones wrote: > Using cabal 1.22 for some reason does not like ?enable-executable-profiling. I am working on a rebuilt machine that had 1.18 from the distribution, with 1.22 installed afterwards. I found a little info on people having this problem, but I failed to fix the problem. > > Note than the library profiling option is accepted. Only the executable fails. > > Is there any know way to start with platform 2014 with GHC 7.8.3 and install cabal 1.22 and can use this option? > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe In Cabal 1.22, --enable-executable-profiling was renamed --enable-profiling because it is not actually possible to enable executable profiling safely without also enabling library profiling. -- Thomas Tuegel From sumit.sahrawat.apm13 at iitbhu.ac.in Sun Jan 18 16:47:06 2015 From: sumit.sahrawat.apm13 at iitbhu.ac.in (Sumit Sahrawat, Maths & Computing, IIT (BHU)) Date: Sun, 18 Jan 2015 22:17:06 +0530 Subject: [Haskell-cafe] Type synonyms considered harmful? In-Reply-To: References: <54BAB2A8.1070504@posteo.de> Message-ID: Projects written in an imperative style are the ones where type synonyms can really help. For example, some gtk functions have horrible type declarations, like adjustmentNew :: Double -> Double -> Double -> Double -> Double -> Double -> IO Adjustment Gtk was designed for an imperative setting, and as such should provide type synonyms to make users more comfortable. In a purely functional style type synonyms are not as necessary. Most functions are self-descriptive, e.g. a function operating on age would make it obvious that it's operating on age, like, incrementAge :: Int -> Int You can argue that this declaration is more informative, as it doesn't hide the details of 'Age' but yet doesn't confuse the reader. As for help provided by the editor, I use emacs-haskell-mode, and it provides interactions with an inferior ghc process. It allows you to query the type and then see the result at the bottom of the window. On 18 January 2015 at 01:37, Mathieu Boespflug wrote: > I tend to reserve type synonyms exclusively for *abbreviating* types, > for example when they end up being long and unwieldy. Since this is > seldom necessary, I seldom use type synonyms. Others (ab?)use type > synonyms to convey semantic information, e.g. > > type Age = Int > > However, if the need for naming things separately at the type level > really is pressing, then one could argue that for that you would be > better served introducing a newtype anyways. > > IOW, my rule of thumb is: type synonyms only as abbreviations, > newtypes for semantically distinct entities, neither when the overhead > of a newtype wouldn't pay its own way in terms of either static > checking or clarity. > > Best, > > Mathieu > > On 17 January 2015 at 20:06, Julian Ospald wrote: > > Hi, > > > > I've recently had a discussion about type synonyms and when to use them > > in haskell. > > > > On the one hand, they make reading type signatures easier and tell you > > what is meant, not just what is inside. On the other hand they also sort > > of hide what is inside, although you will probably need to know exactly > > that when using them. This might make reading code for new collaborators > > more difficult if they have to memorize all type synonyms first. > > > > So there are basically a few questions: > > * What do you think is a good policy for when and how to use them? Or > > would you say just not use them at all and put equivalent information in > > parameter documentation? > > * What are the upsides, downsides, pitfalls and also alternatives? (for > > completeness, also since > > https://www.haskell.org/haskellwiki/Type_synonym is a bit sparse) > > * Can we do something to improve the downsides? Or is there already > > something? (e.g. editor/IDE that can tell me the underlying type, error > > messages etc.) > > > > > > -- > > Regards, > > Julian Ospald > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Regards Sumit Sahrawat -------------- next part -------------- An HTML attachment was scrubbed... URL: From iu.biryukov at gmail.com Sun Jan 18 17:40:35 2015 From: iu.biryukov at gmail.com (=?UTF-8?B?0JjQu9GM0Y8g0JHQuNGA0Y7QutC+0LI=?=) Date: Sun, 18 Jan 2015 21:40:35 +0400 Subject: [Haskell-cafe] Code-completion problem with emacs, ghc-mod and auto-complete In-Reply-To: <78F8A263-E3C8-43BB-B821-CD7B1C27B407@seas.upenn.edu> References: <78F8A263-E3C8-43BB-B821-CD7B1C27B407@seas.upenn.edu> Message-ID: Thanks for pointing me to company-ghc. I've installed it and it works great! -- Regards, Ilya Biryukov. On 18 January 2015 at 00:16, Anthony Cowley wrote: > > > On Jan 17, 2015, at 8:19 AM, ???? ??????? wrote: > > > > Hi, Cafe! > > > > I'm struggling to configure my emacs for haskell development with > ghc-mod and auto-complete. It works well for the most part, but I've run > into the issue when completing qualified names. In the following example I > don't get any completion after BS: > > > > module Playground where > > > > import qualified Data.ByteString.Lazy as BL > > > > doWork :: BL.By -- no completion after dot > > > > Completion for unqualified names and module name in imports works just > fine. > > Maybe someone has run into this issue before? > > > > Completion after the dot is provided by company-ghc, so you'd want to > setup company rather than autocomplete. > > Anthony > > > > My .emacs: > > (ac-config-default) > > (auto-complete-mode t) > > > > (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation) > > > > (autoload 'ghc-init "ghc" nil t) > > (add-hook 'haskell-mode-hook (lambda () (ghc-init))) > > > > (defun my-ac-haskell-mode () > > (setq ac-sources (append ac-sources '(ac-source-ghc-mod)))) > > > > (add-hook 'haskell-mode-hook 'my-ac-haskell-mode) > > (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode) > > (add-hook 'haskell-mode-hook 'turn-on-haskell-indent) > > > > (ac-define-source ghc-mod > > '((depends ghc) > > (candidates . ghc-select-completion-symbol) > > (symbol . "s") > > (cache))) > > > > -- > > Regards, Ilya Biryukov. > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeremy at n-heptane.com Sun Jan 18 20:21:08 2015 From: jeremy at n-heptane.com (Jeremy Shaw) Date: Sun, 18 Jan 2015 14:21:08 -0600 Subject: [Haskell-cafe] Type synonyms considered harmful? In-Reply-To: <54BAB2A8.1070504@posteo.de> References: <54BAB2A8.1070504@posteo.de> Message-ID: In the land of Haskell Web Development, I tend to use newtypes instead of types. In works well in that domain because we often use the types opaquely anyway. For example, I might have a bunch of values like UserId, PageId, etc, which are really just an Int(eger) underneath. Preventing them from being mixed up is good. Also, I am not doing any calculations on them -- just storing, retrieving, and passing them around. Additionally, I am not usually creating the values directly in my code. That is, I don't have a bunch of code like, getUser (UserId 4). It is more like, do uid <- getUserId ; user <- getUser uid. So newtypes are great in this domain. Outside of webdev, it is tempting to use type aliases for functions that have a lot of types where the meaning is not clear: foo :: Int -> Int -> Double -> Double -> Double -> IO () using type alias provides a way to give them meaning: foo :: X -> Y -> Red -> Blue -> Green -> IO () but, that is confusing because it hides the underlying types. It also duplicates information that is available in the function declaration. foo :: Int -> Int -> Double -> Double -> Double -> IO () foo x y r g b = ... Now we see types and description names. Except haddock does not include a way to show the names of the arguments in the docs. Obviously, we need dependent types: foo : (x : Int) -> (y : Int) -> (red : Double) -> (blue : Double) -> (green : Double) -> IO () And that will solve everything! What could possibly go wrong! - jeremy On Sat, Jan 17, 2015 at 1:06 PM, Julian Ospald wrote: > Hi, > > I've recently had a discussion about type synonyms and when to use them > in haskell. > > On the one hand, they make reading type signatures easier and tell you > what is meant, not just what is inside. On the other hand they also sort > of hide what is inside, although you will probably need to know exactly > that when using them. This might make reading code for new collaborators > more difficult if they have to memorize all type synonyms first. > > So there are basically a few questions: > * What do you think is a good policy for when and how to use them? Or > would you say just not use them at all and put equivalent information in > parameter documentation? > * What are the upsides, downsides, pitfalls and also alternatives? (for > completeness, also since > https://www.haskell.org/haskellwiki/Type_synonym is a bit sparse) > * Can we do something to improve the downsides? Or is there already > something? (e.g. editor/IDE that can tell me the underlying type, error > messages etc.) > > > -- > Regards, > Julian Ospald > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chrisdone at gmail.com Sun Jan 18 23:46:05 2015 From: chrisdone at gmail.com (Christopher Done) Date: Mon, 19 Jan 2015 00:46:05 +0100 Subject: [Haskell-cafe] Tooling for equational reasoning in Haskell Message-ID: Hi I quite enjoy doing equational reasoning to prove that my functions satisfy some laws, I like to type out each substitution step until I get back what I started with. The only trouble is that it's rather manual and possibly error prone. Is there any tooling anywhere out there that can take in a Haskell expression and reduce it by one step? I only know of stepeval: http://bm380.user.srcf.net/cgi-bin/stepeval.cgi?expr=foldr+%28%2B%29+0+%5B1%2C2%2C3%5D+%3D%3D+6 But it's just a prototype and works on a teeny weeny subset of Haskell. As much as I like doing tooling, my bandwidth for this area is already full. It seems quite hard to implement such a tool with existing tooling. Real compilers and interpreters tend to be distinctly far away from a simple substitution model or retaining the original source code and being able to print valid source back out. If such a tool existed, though, it'd be super handy and you could probably include it as another check for your build process like your type checking, your quickcheck properties and your unit tests. I would personally invest a little bit of time to add interactive Emacs support for such a tool. Ciao -------------- next part -------------- An HTML attachment was scrubbed... URL: From chrisdone at gmail.com Mon Jan 19 00:02:45 2015 From: chrisdone at gmail.com (Christopher Done) Date: Mon, 19 Jan 2015 01:02:45 +0100 Subject: [Haskell-cafe] Type synonyms considered harmful? In-Reply-To: <54BAB2A8.1070504@posteo.de> References: <54BAB2A8.1070504@posteo.de> Message-ID: I personally really dislike type synonyms, 9 times out of 10 I would prefer to just read a full type than the obscured synonym which hides useful structure from me. On 17 January 2015 at 20:06, Julian Ospald wrote: > Hi, > > I've recently had a discussion about type synonyms and when to use them > in haskell. > > On the one hand, they make reading type signatures easier and tell you > what is meant, not just what is inside. On the other hand they also sort > of hide what is inside, although you will probably need to know exactly > that when using them. This might make reading code for new collaborators > more difficult if they have to memorize all type synonyms first. > > So there are basically a few questions: > * What do you think is a good policy for when and how to use them? Or > would you say just not use them at all and put equivalent information in > parameter documentation? > * What are the upsides, downsides, pitfalls and also alternatives? (for > completeness, also since > https://www.haskell.org/haskellwiki/Type_synonym is a bit sparse) > * Can we do something to improve the downsides? Or is there already > something? (e.g. editor/IDE that can tell me the underlying type, error > messages etc.) > > > -- > Regards, > Julian Ospald > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Mon Jan 19 00:06:37 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 18 Jan 2015 19:06:37 -0500 Subject: [Haskell-cafe] Type synonyms considered harmful? In-Reply-To: References: <54BAB2A8.1070504@posteo.de> Message-ID: On Sun, Jan 18, 2015 at 7:02 PM, Christopher Done wrote: > I personally really dislike type synonyms, 9 times out of 10 I would > prefer to just read a full type than the obscured synonym which hides > useful structure from me. I'm actually inclined to agree with this; the examples where they are intended to clarify an API strike me as places where said API would likely benefit from using actual types anyway so you don't mix things that shouldn't be mixed. (In my experience, most of those are FFI imports or thin wrappers over same, and a higher level Haskelly interface built on top is a better answer than weird synonyms. On the other hand, internal type synonyms to help the author of such an interface keep the FFI parameters straight likely make sense; sadly, there's no way to fix C....) -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From chrisdone at gmail.com Mon Jan 19 00:12:58 2015 From: chrisdone at gmail.com (Christopher Done) Date: Mon, 19 Jan 2015 01:12:58 +0100 Subject: [Haskell-cafe] Type synonyms considered harmful? In-Reply-To: References: <54BAB2A8.1070504@posteo.de> Message-ID: > > foo : (x : Int) -> (y : Int) -> (red : Double) -> (blue : Double) -> > (green : Double) -> IO () > > And that will solve everything! What could possibly go wrong! > How about a type-level the? =p type The label t = t foo :: The red Double -> The green Double -> The blue Double -> IO () Or with polykinds: foo :: The "Red" Double -> The "Green" Double -> The "Blue" Double -> IO () -------------- next part -------------- An HTML attachment was scrubbed... URL: From mariopal at gmail.com Mon Jan 19 00:45:58 2015 From: mariopal at gmail.com (mariopal) Date: Mon, 19 Jan 2015 00:45:58 +0000 (UTC) Subject: [Haskell-cafe] This code produces an infinite output... why? it's a bug in ghc? Message-ID: This code produces an infinite output... why? it's a bug in ghc? > -- Glasgow Haskell Compiler, Version 7.6.3 on Debian Sid > import System.Locale (defaultTimeLocale) > import Data.Time > > > mkDated n = formatTime defaultTimeLocale "%FT%TZ" $ addUTCTime (3600*n) $ UTCTime (fromGregorian 2015 1 1) (timeOfDayToTime $ TimeOfDay 0 0 0) > > main = mapM_ putStrLn $ map mkDated [0..2] From fryguybob at gmail.com Mon Jan 19 01:01:55 2015 From: fryguybob at gmail.com (Ryan Yates) Date: Sun, 18 Jan 2015 20:01:55 -0500 Subject: [Haskell-cafe] This code produces an infinite output... why? it's a bug in ghc? In-Reply-To: References: Message-ID: This has something to do with the Enum instance for NominalDiffTime: ghci> [0..2] :: [NominalDiffTime] ... Appears to also diverge. This works though: ghci> mapM_ putStrLn $ map (mkDated . fromIntegral) [0..2] 2015-01-01T00:00:00Z 2015-01-01T01:00:00Z 2015-01-01T02:00:00Z Ryan On Sun, Jan 18, 2015 at 7:45 PM, mariopal wrote: > This code produces an infinite output... why? it's a bug in ghc? > > > -- Glasgow Haskell Compiler, Version 7.6.3 on Debian Sid > > import System.Locale (defaultTimeLocale) > > import Data.Time > > > > > > mkDated n = formatTime defaultTimeLocale "%FT%TZ" $ addUTCTime (3600*n) $ > UTCTime (fromGregorian 2015 1 1) (timeOfDayToTime $ TimeOfDay 0 0 0) > > > > main = mapM_ putStrLn $ map mkDated [0..2] > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From haskell at nand.wakku.to Mon Jan 19 01:05:56 2015 From: haskell at nand.wakku.to (Niklas Haas) Date: Mon, 19 Jan 2015 02:05:56 +0100 Subject: [Haskell-cafe] Type synonyms considered harmful? In-Reply-To: References: <54BAB2A8.1070504@posteo.de> Message-ID: <20150119020556.GC16519@nanodesu.localdomain> On Mon, 19 Jan 2015 01:12:58 +0100, Christopher Done wrote: > > > > foo : (x : Int) -> (y : Int) -> (red : Double) -> (blue : Double) -> > > (green : Double) -> IO () > > > > And that will solve everything! What could possibly go wrong! > > > > How about a type-level the? =p > > type The label t = t > > foo :: The red Double -> The green Double -> The blue Double -> IO () > > Or with polykinds: > > foo :: The "Red" Double -> The "Green" Double -> The "Blue" Double -> IO () Clearly needs more TypeOperators. type (l ? t) = t foo :: ("red" ? Double) -> ("green" ? Double) -> ("blue" ? Double) -> IO () From mboes at tweag.net Mon Jan 19 07:43:34 2015 From: mboes at tweag.net (Mathieu Boespflug) Date: Mon, 19 Jan 2015 08:43:34 +0100 Subject: [Haskell-cafe] Tooling for equational reasoning in Haskell In-Reply-To: References: Message-ID: Could Hermit be of any relief? http://ku-fpg.github.io/software/hermit/ It doesn't work on the surface syntax, only on the core syntax AFAIK, but some would call that a feature (simpler traversals). So long as you're happy doing this reasoning at the level of Core, this should be workable. I'm not sure that it would be easy to map the result back to surface syntax, but maybe Andy can comment. Best, Mathieu On 19 January 2015 at 00:46, Christopher Done wrote: > Hi > > I quite enjoy doing equational reasoning to prove that my functions satisfy > some laws, I like to type out each substitution step until I get back what I > started with. The only trouble is that it's rather manual and possibly error > prone. > > Is there any tooling anywhere out there that can take in a Haskell > expression and reduce it by one step? I only know of stepeval: > > http://bm380.user.srcf.net/cgi-bin/stepeval.cgi?expr=foldr+%28%2B%29+0+%5B1%2C2%2C3%5D+%3D%3D+6 > > But it's just a prototype and works on a teeny weeny subset of Haskell. As > much as I like doing tooling, my bandwidth for this area is already full. > > It seems quite hard to implement such a tool with existing tooling. Real > compilers and interpreters tend to be distinctly far away from a simple > substitution model or retaining the original source code and being able to > print valid source back out. > > If such a tool existed, though, it'd be super handy and you could probably > include it as another check for your build process like your type checking, > your quickcheck properties and your unit tests. I would personally invest a > little bit of time to add interactive Emacs support for such a tool. > > Ciao > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From polux2001 at gmail.com Mon Jan 19 09:18:28 2015 From: polux2001 at gmail.com (Paul Brauner) Date: Mon, 19 Jan 2015 09:18:28 +0000 Subject: [Haskell-cafe] Tooling for equational reasoning in Haskell References: Message-ID: There was this paper a while ago, not sure where the software can be downloaded: http://ittc.ku.edu/~andygill/papers/IntroHERA06.pdf On Mon Jan 19 2015 at 8:43:49 AM Mathieu Boespflug wrote: > Could Hermit be of any relief? > > http://ku-fpg.github.io/software/hermit/ > > It doesn't work on the surface syntax, only on the core syntax AFAIK, > but some would call that a feature (simpler traversals). So long as > you're happy doing this reasoning at the level of Core, this should be > workable. I'm not sure that it would be easy to map the result back to > surface syntax, but maybe Andy can comment. > > Best, > > Mathieu > > On 19 January 2015 at 00:46, Christopher Done wrote: > > Hi > > > > I quite enjoy doing equational reasoning to prove that my functions > satisfy > > some laws, I like to type out each substitution step until I get back > what I > > started with. The only trouble is that it's rather manual and possibly > error > > prone. > > > > Is there any tooling anywhere out there that can take in a Haskell > > expression and reduce it by one step? I only know of stepeval: > > > > http://bm380.user.srcf.net/cgi-bin/stepeval.cgi?expr= > foldr+%28%2B%29+0+%5B1%2C2%2C3%5D+%3D%3D+6 > > > > But it's just a prototype and works on a teeny weeny subset of Haskell. > As > > much as I like doing tooling, my bandwidth for this area is already full. > > > > It seems quite hard to implement such a tool with existing tooling. Real > > compilers and interpreters tend to be distinctly far away from a simple > > substitution model or retaining the original source code and being able > to > > print valid source back out. > > > > If such a tool existed, though, it'd be super handy and you could > probably > > include it as another check for your build process like your type > checking, > > your quickcheck properties and your unit tests. I would personally > invest a > > little bit of time to add interactive Emacs support for such a tool. > > > > Ciao > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hesselink at gmail.com Mon Jan 19 10:02:11 2015 From: hesselink at gmail.com (Erik Hesselink) Date: Mon, 19 Jan 2015 11:02:11 +0100 Subject: [Haskell-cafe] enable-executable-profiling failing with cabal 1.22 In-Reply-To: References: <00E3ED3C-5DAB-4E91-B3F4-6EA4856A9811@proclivis.com> Message-ID: Note that in the current 1.22 branch, the --{en,dis}able-executable-profiling option (as well as {en,dis}able-library-coverage) was added back in order to be backward compatible. So these problems should not appear with the final release of 1.22. Regarsd, Erik On Sun, Jan 18, 2015 at 4:03 PM, Thomas Tuegel wrote: > On Sat, Jan 17, 2015 at 7:17 PM, Michael Jones wrote: >> Using cabal 1.22 for some reason does not like ?enable-executable-profiling. I am working on a rebuilt machine that had 1.18 from the distribution, with 1.22 installed afterwards. I found a little info on people having this problem, but I failed to fix the problem. >> >> Note than the library profiling option is accepted. Only the executable fails. >> >> Is there any know way to start with platform 2014 with GHC 7.8.3 and install cabal 1.22 and can use this option? >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > In Cabal 1.22, --enable-executable-profiling was renamed > --enable-profiling because it is not actually possible to enable > executable profiling safely without also enabling library profiling. > > -- > Thomas Tuegel > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From chrisdone at gmail.com Mon Jan 19 10:11:43 2015 From: chrisdone at gmail.com (Christopher Done) Date: Mon, 19 Jan 2015 11:11:43 +0100 Subject: [Haskell-cafe] Tooling for equational reasoning in Haskell In-Reply-To: References: Message-ID: Ah, interesting. That last paper demonstration seems promising. I like that it lets you state laws like the monad law. I see it's also Core driven. I'll try it out. I've got a type I want to prove is Applicative and Alternative. Andy, what's your assessment on the difficulty of working with plain Haskell? For example, what if you took your HOOD project and used HSE or TH to annotate a whole source tree from expressions to patterns (with view patterns)? One thing I pondered was, e.g. if you have this program: \x -> x 01234678 -- these are the columns you could transform it to: observe "(0,0)-(1,8)" (\(observe "(0,1)-(0,2)" -> x) -> observe "(0,7)-(0,8)" x) Which would allow you to map back to the original source. But now instead of storing just locations, you want rather than just to see what things are being forced, you want to produce a series of valid source programs. So maybe you store kind of diff instructions, like this: http://lpaste.net/114511 You get something like: orig_ex = (\x -> (\y -> x * y)) 5 7 translated_ex = seq (push (Reset "(\\x -> (\\y -> x * y)) 5 7") ((\x -> (push (Set 0 25 ("(\\y -> " ++ show x ++ " * y)")) (\y -> push (Set 0 13 (show x ++ " * " ++ show y)) (x * y)))) 5 7)) stack ?> readIORef translated_ex >>= mapM_ putStrLn . interpret (\x -> (\y -> x * y)) 5 7 (\y -> 5 * y) 5 * 7 I think the problem I encountered was that I'd need alpha conversion, which would need something like haskell-names to resolve names. A little more involved as a project to pursue. There's probably some fatal flaw that means it's a terrible idea. Presumably you've already considered things like this in your research. Ciao On 19 January 2015 at 10:18, Paul Brauner wrote: > There was this paper a while ago, not sure where the software can be > downloaded: http://ittc.ku.edu/~andygill/papers/IntroHERA06.pdf > > > On Mon Jan 19 2015 at 8:43:49 AM Mathieu Boespflug > wrote: > >> Could Hermit be of any relief? >> >> http://ku-fpg.github.io/software/hermit/ >> >> It doesn't work on the surface syntax, only on the core syntax AFAIK, >> but some would call that a feature (simpler traversals). So long as >> you're happy doing this reasoning at the level of Core, this should be >> workable. I'm not sure that it would be easy to map the result back to >> surface syntax, but maybe Andy can comment. >> >> Best, >> >> Mathieu >> >> On 19 January 2015 at 00:46, Christopher Done >> wrote: >> > Hi >> > >> > I quite enjoy doing equational reasoning to prove that my functions >> satisfy >> > some laws, I like to type out each substitution step until I get back >> what I >> > started with. The only trouble is that it's rather manual and possibly >> error >> > prone. >> > >> > Is there any tooling anywhere out there that can take in a Haskell >> > expression and reduce it by one step? I only know of stepeval: >> > >> > http://bm380.user.srcf.net/cgi-bin/stepeval.cgi?expr= >> foldr+%28%2B%29+0+%5B1%2C2%2C3%5D+%3D%3D+6 >> > >> > But it's just a prototype and works on a teeny weeny subset of Haskell. >> As >> > much as I like doing tooling, my bandwidth for this area is already >> full. >> > >> > It seems quite hard to implement such a tool with existing tooling. Real >> > compilers and interpreters tend to be distinctly far away from a simple >> > substitution model or retaining the original source code and being able >> to >> > print valid source back out. >> > >> > If such a tool existed, though, it'd be super handy and you could >> probably >> > include it as another check for your build process like your type >> checking, >> > your quickcheck properties and your unit tests. I would personally >> invest a >> > little bit of time to add interactive Emacs support for such a tool. >> > >> > Ciao >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> > >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sk at k-hornz.de Mon Jan 19 10:16:05 2015 From: sk at k-hornz.de (Stefan Kersten) Date: Mon, 19 Jan 2015 11:16:05 +0100 Subject: [Haskell-cafe] Type synonyms considered harmful? In-Reply-To: References: <54BAB2A8.1070504@posteo.de> Message-ID: <54BCD965.6030608@k-hornz.de> On 19/01/2015 01:02, Christopher Done wrote: > I personally really dislike type synonyms, 9 times out of 10 I would > prefer to just read a full type than the obscured synonym which hides > useful structure from me. i find type synonyms mostly useful during prototyping, i.e. when what I want is actually a newtype for safer interfaces but I don't want to bother with wrapping/unwrapping or figuring out how to derive instances; this is especially true for monad transformer stacks. later, after the code has settled a bit, it's straight forward, if tedious, to change the type to a newtype and fix the resulting type errors. sk From qdunkan at gmail.com Mon Jan 19 11:15:03 2015 From: qdunkan at gmail.com (Evan Laforge) Date: Mon, 19 Jan 2015 19:15:03 +0800 Subject: [Haskell-cafe] Type synonyms considered harmful? In-Reply-To: <54BAB2A8.1070504@posteo.de> References: <54BAB2A8.1070504@posteo.de> Message-ID: I think they have their place. I use them when it's too much bother to unwrap a newtype but still nice to have some documentation, especially if it shows up in many places but I only want to document in one place. Or if I think a type error is unlikely, or not a big deal, compared to the wrap/unwrap hassle. For documentation it's also nice to have a name to use in haddock. Also I tend to use them when the scope is small. I agree that if the scope is wide, or if it's a library, then they can be not worth it. E.g. I've decided to not use Data.Graph's 'type Forest a = [Tree a]'. It's a convenience vs. correctness trade-off, and it's useful to have something covering the convenience end. Perhaps you shouldn't put them in library APIs though. On Sun, Jan 18, 2015 at 3:06 AM, Julian Ospald wrote: > Hi, > > I've recently had a discussion about type synonyms and when to use them > in haskell. > > On the one hand, they make reading type signatures easier and tell you > what is meant, not just what is inside. On the other hand they also sort > of hide what is inside, although you will probably need to know exactly > that when using them. This might make reading code for new collaborators > more difficult if they have to memorize all type synonyms first. > > So there are basically a few questions: > * What do you think is a good policy for when and how to use them? Or > would you say just not use them at all and put equivalent information in > parameter documentation? > * What are the upsides, downsides, pitfalls and also alternatives? (for > completeness, also since > https://www.haskell.org/haskellwiki/Type_synonym is a bit sparse) > * Can we do something to improve the downsides? Or is there already > something? (e.g. editor/IDE that can tell me the underlying type, error > messages etc.) > > > -- > Regards, > Julian Ospald > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From mboes at tweag.net Mon Jan 19 12:01:15 2015 From: mboes at tweag.net (Mathieu Boespflug) Date: Mon, 19 Jan 2015 13:01:15 +0100 Subject: [Haskell-cafe] Tooling for equational reasoning in Haskell In-Reply-To: References: Message-ID: As far as core to surface syntax is concerned, there is the precedent of the Chameleon compiler (which is now dead, unfortunately). It used to be here: http://www.comp.nus.edu.sg/~sulzmann/chameleon. The compiler would do type checking on the core language, not the surface language. As a result, the type checker was smaller. It would embed links in the core AST to the surface AST in order to map back to the surface AST when reporting errors, etc. On 19 January 2015 at 11:11, Christopher Done wrote: > Ah, interesting. That last paper demonstration seems promising. I like that > it lets you state laws like the monad law. I see it's also Core driven. I'll > try it out. I've got a type I want to prove is Applicative and Alternative. > > Andy, what's your assessment on the difficulty of working with plain > Haskell? > > For example, what if you took your HOOD project and used HSE or TH to > annotate a whole source tree from expressions to patterns (with view > patterns)? One thing I pondered was, e.g. if you have this program: > > \x -> x > 01234678 -- these are the columns > > you could transform it to: > > observe "(0,0)-(1,8)" > (\(observe "(0,1)-(0,2)" -> x) -> > observe "(0,7)-(0,8)" x) > > Which would allow you to map back to the original source. But now instead of > storing just locations, you want rather than just to see what things are > being forced, you want to produce a series of valid source programs. So > maybe you store kind of diff instructions, like this: > http://lpaste.net/114511 You get something like: > > orig_ex = (\x -> (\y -> x * y)) 5 7 > > translated_ex = > seq (push (Reset "(\\x -> (\\y -> x * y)) 5 7") > ((\x -> > (push (Set 0 25 ("(\\y -> " ++ show x ++ " * y)")) > (\y -> > push (Set 0 13 (show x ++ " * " ++ show y)) > (x * y)))) 5 7)) > stack > > ?> readIORef translated_ex >>= mapM_ putStrLn . interpret > (\x -> (\y -> x * y)) 5 7 > (\y -> 5 * y) > 5 * 7 > > I think the problem I encountered was that I'd need alpha conversion, which > would need something like haskell-names to resolve names. A little more > involved as a project to pursue. There's probably some fatal flaw that means > it's a terrible idea. > > Presumably you've already considered things like this in your research. > > Ciao > > On 19 January 2015 at 10:18, Paul Brauner wrote: >> >> There was this paper a while ago, not sure where the software can be >> downloaded: http://ittc.ku.edu/~andygill/papers/IntroHERA06.pdf >> >> >> On Mon Jan 19 2015 at 8:43:49 AM Mathieu Boespflug >> wrote: >>> >>> Could Hermit be of any relief? >>> >>> http://ku-fpg.github.io/software/hermit/ >>> >>> It doesn't work on the surface syntax, only on the core syntax AFAIK, >>> but some would call that a feature (simpler traversals). So long as >>> you're happy doing this reasoning at the level of Core, this should be >>> workable. I'm not sure that it would be easy to map the result back to >>> surface syntax, but maybe Andy can comment. >>> >>> Best, >>> >>> Mathieu >>> >>> On 19 January 2015 at 00:46, Christopher Done >>> wrote: >>> > Hi >>> > >>> > I quite enjoy doing equational reasoning to prove that my functions >>> > satisfy >>> > some laws, I like to type out each substitution step until I get back >>> > what I >>> > started with. The only trouble is that it's rather manual and possibly >>> > error >>> > prone. >>> > >>> > Is there any tooling anywhere out there that can take in a Haskell >>> > expression and reduce it by one step? I only know of stepeval: >>> > >>> > >>> > http://bm380.user.srcf.net/cgi-bin/stepeval.cgi?expr=foldr+%28%2B%29+0+%5B1%2C2%2C3%5D+%3D%3D+6 >>> > >>> > But it's just a prototype and works on a teeny weeny subset of Haskell. >>> > As >>> > much as I like doing tooling, my bandwidth for this area is already >>> > full. >>> > >>> > It seems quite hard to implement such a tool with existing tooling. >>> > Real >>> > compilers and interpreters tend to be distinctly far away from a simple >>> > substitution model or retaining the original source code and being able >>> > to >>> > print valid source back out. >>> > >>> > If such a tool existed, though, it'd be super handy and you could >>> > probably >>> > include it as another check for your build process like your type >>> > checking, >>> > your quickcheck properties and your unit tests. I would personally >>> > invest a >>> > little bit of time to add interactive Emacs support for such a tool. >>> > >>> > Ciao >>> > >>> > _______________________________________________ >>> > Haskell-Cafe mailing list >>> > Haskell-Cafe at haskell.org >>> > http://www.haskell.org/mailman/listinfo/haskell-cafe >>> > >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From haskell at elisehuard.be Mon Jan 19 12:10:38 2015 From: haskell at elisehuard.be (Elise Huard) Date: Mon, 19 Jan 2015 13:10:38 +0100 Subject: [Haskell-cafe] garbage collection for a data structure Message-ID: Hi, I was wondering if there was a way to check whether a particular data structure gets garbage collected in a program. A friendly person pointed me to System.Mem.Weak on the Haskell-Beginner list - however I've been unable to verify how it works, so I'm bumping it to this list. See the following toy program: I was trying to see whether the output would contain "garbage collected". I wondered if performGC is a nudge rather than an immediate "garbage collect now" instruction, and performGC is not actually performed? Or I've misunderstood finalizers in this context and they would not actually be executed when z gets garbage collected? import System.Mem.Weak import System.Mem (performGC) import Control.Concurrent (threadDelay) main :: IO () main = do let x = 5 y = "done" z = 3 a <- mkWeak z x (Just (putStrLn "garbage collected")) performGC threadDelay 20000000 print y Thank you, Elise From eyeinsky9 at gmail.com Mon Jan 19 12:27:16 2015 From: eyeinsky9 at gmail.com (Carl Eyeinsky) Date: Mon, 19 Jan 2015 13:27:16 +0100 Subject: [Haskell-cafe] Type synonyms considered harmful? In-Reply-To: <54BCD965.6030608@k-hornz.de> References: <54BAB2A8.1070504@posteo.de> <54BCD965.6030608@k-hornz.de> Message-ID: I agree with Stefan -- type synonyms are really useful in developing project by yourself (or a small team), where you are the one both using and generating the synonyms, and no-one else needs to care. Then, the simple Age = Int is still very meaningful for yourself in both documenting and directing the writing. But in a public library, finding out that a type X is actually 'Either z' kind of blocks the way -- you don't know how to operate with X until you become to know what it really is.. And then you have to memorize this for the future to stay productive, which is not very easy if there are many libraries that you're using. (But on the other hand if X equals something else and more complex, that you don't know, then the synonym I think becomes more useful again.) On Mon, Jan 19, 2015 at 11:16 AM, Stefan Kersten wrote: > On 19/01/2015 01:02, Christopher Done wrote: > > I personally really dislike type synonyms, 9 times out of 10 I would > > prefer to just read a full type than the obscured synonym which hides > > useful structure from me. > > i find type synonyms mostly useful during prototyping, i.e. when what I > want is actually a newtype for safer interfaces but I don't want to > bother with wrapping/unwrapping or figuring out how to derive instances; > this is especially true for monad transformer stacks. later, after the > code has settled a bit, it's straight forward, if tedious, to change the > type to a newtype and fix the resulting type errors. > > sk > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Carl Eyeinsky -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Mon Jan 19 13:53:17 2015 From: michael at snoyman.com (Michael Snoyman) Date: Mon, 19 Jan 2015 13:53:17 +0000 Subject: [Haskell-cafe] http-client: proxy environment variable support Message-ID: Neil Mitchell opened an issue[1] for http_proxy and https_proxy environment variable support in http-client. I've written that support, and it's ready to go, but there's an open question: what should the default behavior be? In particular, should environment variables, by default, be checked to determine the proxy, or not? Arguments each way: In favor of using environment variables: * Matches behavior of many other tools and libraries * Allows application users control without requiring a code change from application writers Against using environment variables: * It's a change in behavior vs what http-client does today (though that could certainly be seen as just a missing feature) * Environment variables will implicitly change the behavior of code, which generally speaking can be problematic I'm leaning towards having the default behavior be: * If the user explicitly chooses a proxy setting on the manager, use that * If the user explicitly sets a proxy value on the Request, use that * If the environment variable is set, use that * Otherwise, no proxy In addition to whether we should make this change in behavior, I'm also interested in whether people think this should require a major version bump. [1] https://github.com/snoyberg/http-client/issues/94 -------------- next part -------------- An HTML attachment was scrubbed... URL: From miguelimo38 at yandex.ru Mon Jan 19 14:33:17 2015 From: miguelimo38 at yandex.ru (Miguel Mitrofanov) Date: Mon, 19 Jan 2015 17:33:17 +0300 Subject: [Haskell-cafe] http-client: proxy environment variable support In-Reply-To: References: Message-ID: <738971421677997@web15g.yandex.ru> I think it might be good to also allow user to explicitly require not to use proxy, even if it's set in environment. 19.01.2015, 16:53, "Michael Snoyman" : > Neil Mitchell opened an issue[1] for http_proxy and https_proxy environment variable support in http-client. I've written that support, and it's ready to go, but there's an open question: what should the default behavior be? In particular, should environment variables, by default, be checked to determine the proxy, or not? Arguments each way: > > In favor of using environment variables: > * Matches behavior of many other tools and libraries > * Allows application users control without requiring a code change from application writers > > Against using environment variables: > * It's a change in behavior vs what http-client does today (though that could certainly be seen as just a missing feature) > * Environment variables will implicitly change the behavior of code, which generally speaking can be problematic > > I'm leaning towards having the default behavior be: > > * If the user explicitly chooses a proxy setting on the manager, use that > * If the user explicitly sets a proxy value on the Request, use that > * If the environment variable is set, use that > * Otherwise, no proxy > > In addition to whether we should make this change in behavior, I'm also interested in whether people think this should require a major version bump. > > [1]?https://github.com/snoyberg/http-client/issues/94 > , > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From michael at snoyman.com Mon Jan 19 14:34:48 2015 From: michael at snoyman.com (Michael Snoyman) Date: Mon, 19 Jan 2015 14:34:48 +0000 Subject: [Haskell-cafe] http-client: proxy environment variable support References: <738971421677997@web15g.yandex.ru> Message-ID: Definitely, that's part of the changeset already. On Mon Jan 19 2015 at 4:33:25 PM Miguel Mitrofanov wrote: > I think it might be good to also allow user to explicitly require not to > use proxy, even if it's set in environment. > > 19.01.2015, 16:53, "Michael Snoyman" : > > Neil Mitchell opened an issue[1] for http_proxy and https_proxy > environment variable support in http-client. I've written that support, and > it's ready to go, but there's an open question: what should the default > behavior be? In particular, should environment variables, by default, be > checked to determine the proxy, or not? Arguments each way: > > > > In favor of using environment variables: > > * Matches behavior of many other tools and libraries > > * Allows application users control without requiring a code change from > application writers > > > > Against using environment variables: > > * It's a change in behavior vs what http-client does today (though that > could certainly be seen as just a missing feature) > > * Environment variables will implicitly change the behavior of code, > which generally speaking can be problematic > > > > I'm leaning towards having the default behavior be: > > > > * If the user explicitly chooses a proxy setting on the manager, use that > > * If the user explicitly sets a proxy value on the Request, use that > > * If the environment variable is set, use that > > * Otherwise, no proxy > > > > In addition to whether we should make this change in behavior, I'm also > interested in whether people think this should require a major version bump. > > > > [1] https://github.com/snoyberg/http-client/issues/94 > > , > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.abel at ifi.lmu.de Mon Jan 19 14:53:53 2015 From: andreas.abel at ifi.lmu.de (Andreas Abel) Date: Mon, 19 Jan 2015 15:53:53 +0100 Subject: [Haskell-cafe] Type synonyms considered harmful? In-Reply-To: References: <54BAB2A8.1070504@posteo.de> Message-ID: <54BD1A81.2090708@ifi.lmu.de> In general, use newtypes instead of type synonyms, and records instead of tuples. Also, ghc has its flaws when dealing with type synonyms, i.e., in error messages you find a type synoym needlessly expanded. Does anyone know a programming language that has type synonyms and always uses the type syn. in error messages when the user originally wrote it? I'd be eager to learn. Cheers, Andreas On 19.01.2015 12:15, Evan Laforge wrote: > I think they have their place. I use them when it's too much bother > to unwrap a newtype but still nice to have some documentation, > especially if it shows up in many places but I only want to document > in one place. Or if I think a type error is unlikely, or not a big > deal, compared to the wrap/unwrap hassle. For documentation it's also > nice to have a name to use in haddock. Also I tend to use them when > the scope is small. I agree that if the scope is wide, or if it's a > library, then they can be not worth it. E.g. I've decided to not use > Data.Graph's 'type Forest a = [Tree a]'. > > It's a convenience vs. correctness trade-off, and it's useful to have > something covering the convenience end. Perhaps you shouldn't put > them in library APIs though. > > On Sun, Jan 18, 2015 at 3:06 AM, Julian Ospald wrote: >> Hi, >> >> I've recently had a discussion about type synonyms and when to use them >> in haskell. >> >> On the one hand, they make reading type signatures easier and tell you >> what is meant, not just what is inside. On the other hand they also sort >> of hide what is inside, although you will probably need to know exactly >> that when using them. This might make reading code for new collaborators >> more difficult if they have to memorize all type synonyms first. >> >> So there are basically a few questions: >> * What do you think is a good policy for when and how to use them? Or >> would you say just not use them at all and put equivalent information in >> parameter documentation? >> * What are the upsides, downsides, pitfalls and also alternatives? (for >> completeness, also since >> https://www.haskell.org/haskellwiki/Type_synonym is a bit sparse) >> * Can we do something to improve the downsides? Or is there already >> something? (e.g. editor/IDE that can tell me the underlying type, error >> messages etc.) >> >> >> -- >> Regards, >> Julian Ospald >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Andreas Abel <>< Du bist der geliebte Mensch. Department of Computer Science and Engineering Chalmers and Gothenburg University, Sweden andreas.abel at gu.se http://www2.tcs.ifi.lmu.de/~abel/ From david.feuer at gmail.com Mon Jan 19 16:35:55 2015 From: david.feuer at gmail.com (David Feuer) Date: Mon, 19 Jan 2015 11:35:55 -0500 Subject: [Haskell-cafe] garbage collection for a data structure In-Reply-To: References: Message-ID: On Jan 19, 2015 7:10 AM, "Elise Huard" wrote: > > Hi, > > I was wondering if there was a way to check whether a particular data > structure gets garbage collected in a program. A friendly person > pointed me to System.Mem.Weak on the Haskell-Beginner list - however > I've been unable to verify how it works, so I'm bumping it to this > list. Yes, sort of. You can use that to tell if a certain *constructor* has been collected, but that's not always so helpful. For instance, if you make a weak pointer to a list, and find that it's been collected, that just means the first (:) constructor has been collected. It may well be that the rest of the list spine and all its elements are still live. I ran into this problem trying to find out if an Array had been collected. It turned out that the Array constructor that holds the array bounds had been, but the actual Array# holding the elements was still around! > See the following toy program: I was trying to see whether the output > would contain "garbage collected". I'm not sure what the deal is there exactly, but my *guess* is that GHC may never actually bother allocating x or z at all. Finalizers are not guaranteed to ever run; they're a sort of "please, if you have the time" kind of thing. > I wondered if performGC is a nudge rather than an immediate "garbage > collect now" instruction, and performGC is not actually performed? No, I think that's a pretty definite "Do this now." I just think the garbage you *think* exists and the garbage that *actually* exists are probably different. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean at functionaljobs.com Mon Jan 19 17:00:01 2015 From: sean at functionaljobs.com (Functional Jobs) Date: Mon, 19 Jan 2015 12:00:01 -0500 Subject: [Haskell-cafe] New Functional Programming Job Opportunities Message-ID: <54bd381417a4d@functionaljobs.com> Here are some functional programming job opportunities that were posted recently: Functional Software Developer at Moixa Technology http://functionaljobs.com/jobs/8778-functional-software-developer-at-moixa-technology Cheers, Sean Murphy FunctionalJobs.com From chrisdone at gmail.com Tue Jan 20 00:26:36 2015 From: chrisdone at gmail.com (Christopher Done) Date: Tue, 20 Jan 2015 01:26:36 +0100 Subject: [Haskell-cafe] Fwd: Announcing a solution to the records problem In-Reply-To: References: Message-ID: Forwarding to Haskell-cafe because not as many people read libraries at . ---------- Forwarded message ---------- From: Nikita Volkov Date: 19 January 2015 at 05:54 Subject: Announcing a solution to the records problem To: Haskell Libraries This thing seems to be going viral on social networks already, nonetheless here's a link for those of you, who aren't yet informed: http://nikita-volkov.github.io/record/ _______________________________________________ Libraries mailing list Libraries at haskell.org http://www.haskell.org/mailman/listinfo/libraries -------------- next part -------------- An HTML attachment was scrubbed... URL: From codygman.consulting at gmail.com Tue Jan 20 05:09:34 2015 From: codygman.consulting at gmail.com (Cody Goodman) Date: Mon, 19 Jan 2015 23:09:34 -0600 Subject: [Haskell-cafe] Help with identity functor print instance and monad transformers Message-ID: I understand the error below, but I'm not really sure what an instance of liftIO would look like for the Identity functor. I guess I'm not all to clear on what an identity functor is. I'm a little fuzzy on what an identity monad is. I understand that id gives the identity of something back pretty well though. Can anyone help? If anyone could help me fix the code below as well as explain the questions I have above it would be a great help. import Control.Monad.Trans.State import Control.Monad.IO.Class type MyState = State Int modAndPrintState :: Int -> MyState () modAndPrintState x = do get >>= \i -> do liftIO . print $ i if even x then put (x + i) else put (i * (x + 1) - x) main = undefined -- Prelude Control.Monad.Trans.State> :r -- [1 of 1] Compiling Main ( blah2.hs, interpreted ) -- blah2.hs:9:5: -- No instance for (MonadIO Data.Functor.Identity.Identity) -- arising from a use of `liftIO' -- Possible fix: -- add an instance declaration for -- (MonadIO Data.Functor.Identity.Identity) -- In the first argument of `(.)', namely `liftIO' -- In the expression: liftIO . print -- In a stmt of a 'do' block: liftIO . print $ i -- Failed, modules loaded: none. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From ky3 at atamo.com Tue Jan 20 05:26:05 2015 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Tue, 20 Jan 2015 12:26:05 +0700 Subject: [Haskell-cafe] Help with identity functor print instance and monad transformers In-Reply-To: References: Message-ID: On Tue, Jan 20, 2015 at 12:09 PM, Cody Goodman < codygman.consulting at gmail.com> wrote: > type MyState = State Int > > modAndPrintState :: Int -> MyState () > modAndPrintState x = do > get >>= \i -> do > liftIO . print $ i > if even x then put (x + i) else put (i * (x + 1) - x) > This code works in the State monad and the only effect there is what it says on the tin: state, not IO. So the code gets use of put and get, but not print. Others will soon chime in on StateT solutions, but from the looks of it, you merely want to display the trace of the state. In which case look to Debug.Trace. -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From haskell at elisehuard.be Tue Jan 20 10:03:16 2015 From: haskell at elisehuard.be (Elise Huard) Date: Tue, 20 Jan 2015 11:03:16 +0100 Subject: [Haskell-cafe] garbage collection for a data structure In-Reply-To: References: Message-ID: > Yes, sort of. You can use that to tell if a certain *constructor* has been > collected, but that's not always so helpful. For instance, if you make a > weak pointer to a list, and find that it's been collected, that just means > the first (:) constructor has been collected. It may well be that the rest > of the list spine and all its elements are still live. I ran into this > problem trying to find out if an Array had been collected. It turned out > that the Array constructor that holds the array bounds had been, but the > actual Array# holding the elements was still around! Ah, thanks, that clears it up somewhat > I'm not sure what the deal is there exactly, but my *guess* is that GHC may > never actually bother allocating x or z at all. Finalizers are not > guaranteed to ever run; they're a sort of "please, if you have the time" > kind of thing. Ah, you mean the literals may fall under this? https://ghc.haskell.org/trac/ghc/wiki/Commentary/Rts/Storage/GC/CAFs?redirectedfrom=Commentary/Rts/Storage/CAFs Or are they optimized away because never actually used? Thanks, I learned something. I changed the program to perform an operation and print out the result with the values, but the finalizer still didn't run - I might shelve this one for later examination. Thank you, Elise From ky3 at atamo.com Tue Jan 20 11:54:30 2015 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Tue, 20 Jan 2015 18:54:30 +0700 Subject: [Haskell-cafe] garbage collection for a data structure In-Reply-To: References: Message-ID: Elise, I remember that your earlier email on the beginner list asked about "diffing from moment to moment." Perhaps you can sketch what you're trying to achieve? Because once you get into the internals of GC the learning ramp gets very, very steep. There are traps known and unknown for both the wary and unwary, as a cursory overview of GHC trac will inform. There's probably a way of getting things to work without relying on implementation-specific haskell. -- Kim-Ee On Mon, Jan 19, 2015 at 7:10 PM, Elise Huard wrote: > Hi, > > I was wondering if there was a way to check whether a particular data > structure gets garbage collected in a program. A friendly person > pointed me to System.Mem.Weak on the Haskell-Beginner list - however > I've been unable to verify how it works, so I'm bumping it to this > list. > > See the following toy program: I was trying to see whether the output > would contain "garbage collected". > I wondered if performGC is a nudge rather than an immediate "garbage > collect now" instruction, and performGC is not actually performed? Or I've > misunderstood finalizers in this context and they would not actually > be executed when z gets garbage collected? > > import System.Mem.Weak > import System.Mem (performGC) > import Control.Concurrent (threadDelay) > > > main :: IO () > main = do let x = 5 > y = "done" > z = 3 > a <- mkWeak z x (Just (putStrLn "garbage collected")) > performGC > threadDelay 20000000 > print y > > Thank you, > > Elise > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ekmett at gmail.com Tue Jan 20 12:09:24 2015 From: ekmett at gmail.com (Edward Kmett) Date: Tue, 20 Jan 2015 07:09:24 -0500 Subject: [Haskell-cafe] StateT and ContT In-Reply-To: References: Message-ID: You pinged me on it while I was in the middle of a trip, and when I went to dig into the issue, the rabbit hole went a lot deeper than I could devote at the time. Excuses aside, it does appear that the primary reason for the current behavior is to match existing prior behavior. That said, I'm not sure there is a good way to offer an upgrade path to change the behavior, as it is the sort of thing that would just silently break very large chunks of code in very subtle ways with the user having no reason to suspect that a change in the underlying semantics of the mtl was to blame, so I'm rather reticent about just diving in and "fixing" it as basically every existing user of the instance is pretty much guaranteed to have breakage. -Edward On Sun, Jan 18, 2015 at 5:56 AM, Ivan Lazar Miljenovic < ivan.miljenovic at gmail.com> wrote: > In the transformers library, there are two implementations for callCC > for use with StateT (both lazy and strict) [1,2], the second of which > is documented to not satisfy the laws of a monad transformer. > > [1]: > http://hackage.haskell.org/package/transformers-0.4.2.0/docs/Control-Monad-Trans-State-Lazy.html#v:liftCallCC > [2]: > http://hackage.haskell.org/package/transformers-0.4.2.0/docs/Control-Monad-Trans-State-Lazy.html#v:liftCallCC-39- > > However, in mtl the MonadCont class [3] uses the second definition for > the StateT instance. Is there a good reason for this, or just to > match the behaviour of pre-transformers mtl [4] ? > > [3]: > http://hackage.haskell.org/package/mtl-2.2.1/docs/Control-Monad-Cont-Class.html > [4]: > http://hackage.haskell.org/package/mtl-1.1.1.1/docs/src/Control-Monad-State-Lazy.html > > (I did raise an issue for this on mtl's Github issue tracker, but it > hasn't had any responses for two months.) > > -- > Ivan Lazar Miljenovic > Ivan.Miljenovic at gmail.com > http://IvanMiljenovic.wordpress.com > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From k-bx at k-bx.com Tue Jan 20 12:33:22 2015 From: k-bx at k-bx.com (Konstantine Rybnikov) Date: Tue, 20 Jan 2015 14:33:22 +0200 Subject: [Haskell-cafe] MonoidHashMap? Message-ID: Hi! I'm working with a lot of HashMap's and it's very frustrating how many times I've "lost" my data because of usage of either a Monoid instance of a HashMap (which is defined as H.union, which, upon collision, takes value from first hm and discards from second), or just using fromList in the wrong place. Whereas the data I'm working is is mostly defined as (Monoid v => HashMap k v), so what I need "by default" is actually something like `H.unionWith (<>)`. What I was wondering is this: is something like MonoidHashMap is desired to be in unordered-containers, or is this use-case only popular in my programs? I'm asking because I have a feeling that this thing might be useful quite a lot for others also. If not -- sorry for bothering :) Cheers! -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Tue Jan 20 12:45:08 2015 From: michael at snoyman.com (Michael Snoyman) Date: Tue, 20 Jan 2015 12:45:08 +0000 Subject: [Haskell-cafe] MonoidHashMap? References: Message-ID: I've definitely wanted it in the past, and have even implemented limited versions of it before. I'd be open to adding it to Data.Containers in mono-traversable[1]. [1] http://www.stackage.org/haddock/nightly-2015-01-20/mono-traversable-0.7.0/Data-Containers.html On Tue Jan 20 2015 at 4:34:00 AM Konstantine Rybnikov wrote: > Hi! > > I'm working with a lot of HashMap's and it's very frustrating how many > times I've "lost" my data because of usage of either a Monoid instance of a > HashMap (which is defined as H.union, which, upon collision, takes value > from first hm and discards from second), or just using fromList in the > wrong place. Whereas the data I'm working is is mostly defined as (Monoid v > => HashMap k v), so what I need "by default" is actually something like > `H.unionWith (<>)`. > > What I was wondering is this: is something like MonoidHashMap is desired > to be in unordered-containers, or is this use-case only popular in my > programs? I'm asking because I have a feeling that this thing might be > useful quite a lot for others also. If not -- sorry for bothering :) > > Cheers! > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at bergmark.nl Tue Jan 20 12:52:21 2015 From: adam at bergmark.nl (Adam Bergmark) Date: Tue, 20 Jan 2015 13:52:21 +0100 Subject: [Haskell-cafe] MonoidHashMap? In-Reply-To: References: Message-ID: +1 On Tue, Jan 20, 2015 at 1:45 PM, Michael Snoyman wrote: > I've definitely wanted it in the past, and have even implemented limited > versions of it before. I'd be open to adding it to Data.Containers in > mono-traversable[1]. > > [1] > http://www.stackage.org/haddock/nightly-2015-01-20/mono-traversable-0.7.0/Data-Containers.html > > On Tue Jan 20 2015 at 4:34:00 AM Konstantine Rybnikov > wrote: > >> Hi! >> >> I'm working with a lot of HashMap's and it's very frustrating how many >> times I've "lost" my data because of usage of either a Monoid instance of a >> HashMap (which is defined as H.union, which, upon collision, takes value >> from first hm and discards from second), or just using fromList in the >> wrong place. Whereas the data I'm working is is mostly defined as (Monoid v >> => HashMap k v), so what I need "by default" is actually something like >> `H.unionWith (<>)`. >> >> What I was wondering is this: is something like MonoidHashMap is desired >> to be in unordered-containers, or is this use-case only popular in my >> programs? I'm asking because I have a feeling that this thing might be >> useful quite a lot for others also. If not -- sorry for bothering :) >> >> Cheers! >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Tue Jan 20 13:09:13 2015 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Wed, 21 Jan 2015 00:09:13 +1100 Subject: [Haskell-cafe] StateT and ContT In-Reply-To: References: Message-ID: On 20 January 2015 at 23:09, Edward Kmett wrote: > You pinged me on it while I was in the middle of a trip, and when I went to > dig into the issue, the rabbit hole went a lot deeper than I could devote at > the time. Apologies if I sounded harsh about the "no response" in my previous email; it certainly wasn't my intent. > > Excuses aside, it does appear that the primary reason for the current > behavior is to match existing prior behavior. > > That said, I'm not sure there is a good way to offer an upgrade path to > change the behavior, as it is the sort of thing that would just silently > break very large chunks of code in very subtle ways with the user having no > reason to suspect that a change in the underlying semantics of the mtl was > to blame, so I'm rather reticent about just diving in and "fixing" it as > basically every existing user of the instance is pretty much guaranteed to > have breakage. This is what I thought: I just wanted to make sure that I wasn't missing something (especially since there's no real documentation that I could find as to _how_ liftCallCC' fails to satisfy the laws of a monad transformer). > > -Edward > > > On Sun, Jan 18, 2015 at 5:56 AM, Ivan Lazar Miljenovic > wrote: >> >> In the transformers library, there are two implementations for callCC >> for use with StateT (both lazy and strict) [1,2], the second of which >> is documented to not satisfy the laws of a monad transformer. >> >> [1]: >> http://hackage.haskell.org/package/transformers-0.4.2.0/docs/Control-Monad-Trans-State-Lazy.html#v:liftCallCC >> [2]: >> http://hackage.haskell.org/package/transformers-0.4.2.0/docs/Control-Monad-Trans-State-Lazy.html#v:liftCallCC-39- >> >> However, in mtl the MonadCont class [3] uses the second definition for >> the StateT instance. Is there a good reason for this, or just to >> match the behaviour of pre-transformers mtl [4] ? >> >> [3]: >> http://hackage.haskell.org/package/mtl-2.2.1/docs/Control-Monad-Cont-Class.html >> [4]: >> http://hackage.haskell.org/package/mtl-1.1.1.1/docs/src/Control-Monad-State-Lazy.html >> >> (I did raise an issue for this on mtl's Github issue tracker, but it >> hasn't had any responses for two months.) >> >> -- >> Ivan Lazar Miljenovic >> Ivan.Miljenovic at gmail.com >> http://IvanMiljenovic.wordpress.com >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From tdammers at gmail.com Tue Jan 20 13:44:21 2015 From: tdammers at gmail.com (Tobias Dammers) Date: Tue, 20 Jan 2015 14:44:21 +0100 Subject: [Haskell-cafe] MonoidHashMap? In-Reply-To: References: Message-ID: <20150120134419.GA30244@nibbler> Pragmatic workaround: newtype-wrap HashMap? On Tue, Jan 20, 2015 at 02:33:22PM +0200, Konstantine Rybnikov wrote: > Hi! > > I'm working with a lot of HashMap's and it's very frustrating how many > times I've "lost" my data because of usage of either a Monoid instance of a > HashMap (which is defined as H.union, which, upon collision, takes value > from first hm and discards from second), or just using fromList in the > wrong place. Whereas the data I'm working is is mostly defined as (Monoid v > => HashMap k v), so what I need "by default" is actually something like > `H.unionWith (<>)`. > > What I was wondering is this: is something like MonoidHashMap is desired to > be in unordered-containers, or is this use-case only popular in my > programs? I'm asking because I have a feeling that this thing might be > useful quite a lot for others also. If not -- sorry for bothering :) > > Cheers! > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -- Tobias Dammers - tobias at twokings.nl - 070-3457628 - www.twokings.nl Maandag t/m donderdag van 9.00 tot 17.30 Voor dringende vragen, mail naar support at twokings.nl From k-bx at k-bx.com Tue Jan 20 13:52:25 2015 From: k-bx at k-bx.com (Konstantine Rybnikov) Date: Tue, 20 Jan 2015 15:52:25 +0200 Subject: [Haskell-cafe] MonoidHashMap? In-Reply-To: <20150120134419.GA30244@nibbler> References: <20150120134419.GA30244@nibbler> Message-ID: I do have many newtypes for different datas, and defined correct Monoid instances for them. The problem arises when you need to convert between them in different ways, or when you write generic HashMap-related code. On Tue, Jan 20, 2015 at 3:44 PM, Tobias Dammers wrote: > Pragmatic workaround: newtype-wrap HashMap? > > On Tue, Jan 20, 2015 at 02:33:22PM +0200, Konstantine Rybnikov wrote: > > Hi! > > > > I'm working with a lot of HashMap's and it's very frustrating how many > > times I've "lost" my data because of usage of either a Monoid instance > of a > > HashMap (which is defined as H.union, which, upon collision, takes value > > from first hm and discards from second), or just using fromList in the > > wrong place. Whereas the data I'm working is is mostly defined as > (Monoid v > > => HashMap k v), so what I need "by default" is actually something like > > `H.unionWith (<>)`. > > > > What I was wondering is this: is something like MonoidHashMap is desired > to > > be in unordered-containers, or is this use-case only popular in my > > programs? I'm asking because I have a feeling that this thing might be > > useful quite a lot for others also. If not -- sorry for bothering :) > > > > Cheers! > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > -- > Tobias Dammers - tobias at twokings.nl - 070-3457628 - www.twokings.nl > Maandag t/m donderdag van 9.00 tot 17.30 > Voor dringende vragen, mail naar support at twokings.nl > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean.leather at gmail.com Tue Jan 20 14:15:12 2015 From: sean.leather at gmail.com (Sean Leather) Date: Tue, 20 Jan 2015 16:15:12 +0200 Subject: [Haskell-cafe] MonoidHashMap? In-Reply-To: References: Message-ID: On Tue, Jan 20, 2015 at 2:33 PM, Konstantine Rybnikov wrote: > I'm working with a lot of HashMap's and it's very frustrating how many > times I've "lost" my data because of usage of either a Monoid instance of a > HashMap (which is defined as H.union, which, upon collision, takes value > from first hm and discards from second), or just using fromList in the > wrong place. Whereas the data I'm working is is mostly defined as (Monoid v > => HashMap k v), so what I need "by default" is actually something like > `H.unionWith (<>)`. > > What I was wondering is this: is something like MonoidHashMap is desired > to be in unordered-containers? Definitely! I have often wished the Monoid instances for both HashMap and Map had `mappend = unionWith mappend` [1]. It may be trivial to write a newtype wrapper and Monoid instance, but it's tedious to use many library functions with that wrapper. This would be more useful to have in containers and unordered-containers, rather than in separate packages, for discoverability and maintainability. Regards, Sean [1] Assuming that was already the case, I believe we could get the `mappend = union` approach by coercing the value type to Data.Monoid.First. Of course, there are other useful monoids for the taking, as well. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at smart-cactus.org Tue Jan 20 15:02:16 2015 From: ben at smart-cactus.org (Ben Gamari) Date: Tue, 20 Jan 2015 10:02:16 -0500 Subject: [Haskell-cafe] MonoidHashMap? In-Reply-To: References: Message-ID: <5E792251-A108-4E29-AD04-B409E3274386@smart-cactus.org> On January 20, 2015 9:15:12 AM EST, Sean Leather wrote: >On Tue, Jan 20, 2015 at 2:33 PM, Konstantine Rybnikov wrote: > >> I'm working with a lot of HashMap's and it's very frustrating how >many >> times I've "lost" my data because of usage of either a Monoid >instance of a >> HashMap (which is defined as H.union, which, upon collision, takes >value >> from first hm and discards from second), or just using fromList in >the >> wrong place. Whereas the data I'm working is is mostly defined as >(Monoid v >> => HashMap k v), so what I need "by default" is actually something >like >> `H.unionWith (<>)`. >> >> What I was wondering is this: is something like MonoidHashMap is >desired >> to be in unordered-containers? > > >Definitely! > Agreed. I have also often needed these semantics. >I have often wished the Monoid instances for both HashMap and Map had >`mappend = unionWith mappend` [1]. It may be trivial to write a newtype >wrapper and Monoid instance, but it's tedious to use many library >functions >with that wrapper. > Things aren't quite as bad with the newtype package or the many interfaces provided by lens. >This would be more useful to have in containers and >unordered-containers, >rather than in separate packages, for discoverability and >maintainability. > Agreed, being in containers does lower the energy barrier. In the past there have been discussions on changing the semantics of the instances provided by these packages to use monoidal accumulation. Thankfully this did not happen but adding newtypes seems like a good compromise. The trouble is that the Newtype and Wrapped instances that would make these instances usable would have to be provided outside of containers/unordered-containers to avoid adding dependencies. This slightly complicates the situation. In light of this the benefits of placing these types in their own package may outweigh those of sticking them in containers. Cheers, - Ben From ben at smart-cactus.org Tue Jan 20 17:35:02 2015 From: ben at smart-cactus.org (Ben Gamari) Date: Tue, 20 Jan 2015 12:35:02 -0500 Subject: [Haskell-cafe] MonoidHashMap? In-Reply-To: <20150120134419.GA30244@nibbler> References: <20150120134419.GA30244@nibbler> Message-ID: <87y4oxcq49.fsf@gmail.com> Tobias Dammers writes: > Pragmatic workaround: newtype-wrap HashMap? > I've put up a quick package wrapping `HashMap` and `Map` with the appropriate Monoid instance here [1]. In addition to the types themselves and a wide variety of `lens` and `newtype` instances, I export a selection of the more widely used functions supported by `Map` and `HashMap`. Those functions that aren't exported can be wrapped using the `Wrapping` or `Newtype` instance without too much trouble or if there's demand I wouldn't be opposed to exporting more of `Map`'s functionality. Patches accepted. Cheers, - Ben [1] https://github.com/bgamari/monoidal-containers http://hackage.haskell.org/package/monoidal-containers -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 472 bytes Desc: not available URL: From R.Paterson at city.ac.uk Tue Jan 20 18:02:43 2015 From: R.Paterson at city.ac.uk (Ross Paterson) Date: Tue, 20 Jan 2015 18:02:43 +0000 Subject: [Haskell-cafe] StateT and ContT In-Reply-To: References: Message-ID: <20150120180243.GA4444@city.ac.uk> On Wed, Jan 21, 2015 at 12:09:13AM +1100, Ivan Lazar Miljenovic wrote: > This is what I thought: I just wanted to make sure that I wasn't > missing something (especially since there's no real documentation that > I could find as to _how_ liftCallCC' fails to satisfy the laws of a > monad transformer). Any lifting of callCC should satisfy lift (f k) = f' (lift . k) => lift (callCC f) = liftCallCC callCC f' and liftCallCC' doesn't. From danburton.email at gmail.com Tue Jan 20 18:19:47 2015 From: danburton.email at gmail.com (Dan Burton) Date: Tue, 20 Jan 2015 10:19:47 -0800 Subject: [Haskell-cafe] StateT and ContT In-Reply-To: <20150120180243.GA4444@city.ac.uk> References: <20150120180243.GA4444@city.ac.uk> Message-ID: Do people actually *use* the MonadCont class? And those who do... do they really use it in a way that would manifest this breakage? basically every existing user of the instance is pretty much guaranteed to > have breakage. It seems the answer to these questions is "yes" and "yes." I'm curious to hear more. -- Dan Burton On Tue, Jan 20, 2015 at 10:02 AM, Ross Paterson wrote: > On Wed, Jan 21, 2015 at 12:09:13AM +1100, Ivan Lazar Miljenovic wrote: > > This is what I thought: I just wanted to make sure that I wasn't > > missing something (especially since there's no real documentation that > > I could find as to _how_ liftCallCC' fails to satisfy the laws of a > > monad transformer). > > Any lifting of callCC should satisfy > > lift (f k) = f' (lift . k) => lift (callCC f) = liftCallCC callCC > f' > > and liftCallCC' doesn't. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From danburton.email at gmail.com Tue Jan 20 18:34:04 2015 From: danburton.email at gmail.com (Dan Burton) Date: Tue, 20 Jan 2015 10:34:04 -0800 Subject: [Haskell-cafe] StateT and ContT In-Reply-To: References: <20150120180243.GA4444@city.ac.uk> Message-ID: > > And those who do... do they really use it in a way that would manifest > this breakage? Never mind, this is obviously the case; I just had to refresh my mind on what the difference was between the two implementations. (Continuation gets called with original vs latest state.) -- Dan Burton On Tue, Jan 20, 2015 at 10:19 AM, Dan Burton wrote: > Do people actually *use* the MonadCont class? And those who do... do they > really use it in a way that would manifest this breakage? > > basically every existing user of the instance is pretty much guaranteed to >> have breakage. > > > It seems the answer to these questions is "yes" and "yes." I'm curious to > hear more. > > -- Dan Burton > > On Tue, Jan 20, 2015 at 10:02 AM, Ross Paterson > wrote: > >> On Wed, Jan 21, 2015 at 12:09:13AM +1100, Ivan Lazar Miljenovic wrote: >> > This is what I thought: I just wanted to make sure that I wasn't >> > missing something (especially since there's no real documentation that >> > I could find as to _how_ liftCallCC' fails to satisfy the laws of a >> > monad transformer). >> >> Any lifting of callCC should satisfy >> >> lift (f k) = f' (lift . k) => lift (callCC f) = liftCallCC callCC >> f' >> >> and liftCallCC' doesn't. >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeremy at n-heptane.com Wed Jan 21 15:25:50 2015 From: jeremy at n-heptane.com (Jeremy Shaw) Date: Wed, 21 Jan 2015 09:25:50 -0600 Subject: [Haskell-cafe] Type synonyms considered harmful? In-Reply-To: <20150119020556.GC16519@nanodesu.localdomain> References: <54BAB2A8.1070504@posteo.de> <20150119020556.GC16519@nanodesu.localdomain> Message-ID: Now we're definitely getting somewhere! I'm not to thrilled about the use of string literals though. How about this? {-# LANGUAGE TypeOperators, DataKinds, RankNTypes #-} type (l ? t) = t foo :: forall red green blue. (red ? Double) -> (green ? Double) -> (blue ? Double) -> IO () We just need to patch hlint to make this the suggested style. - jeremy On Sun, Jan 18, 2015 at 7:05 PM, Niklas Haas wrote: > On Mon, 19 Jan 2015 01:12:58 +0100, Christopher Done > wrote: > > > > > > foo : (x : Int) -> (y : Int) -> (red : Double) -> (blue : Double) -> > > > (green : Double) -> IO () > > > > > > And that will solve everything! What could possibly go wrong! > > > > > > > How about a type-level the? =p > > > > type The label t = t > > > > foo :: The red Double -> The green Double -> The blue Double -> IO () > > > > Or with polykinds: > > > > foo :: The "Red" Double -> The "Green" Double -> The "Blue" Double -> IO > () > > Clearly needs more TypeOperators. > > type (l ? t) = t > > foo :: ("red" ? Double) -> ("green" ? Double) -> ("blue" ? Double) -> IO () > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From haskell at nand.wakku.to Wed Jan 21 15:32:04 2015 From: haskell at nand.wakku.to (Niklas Haas) Date: Wed, 21 Jan 2015 16:32:04 +0100 Subject: [Haskell-cafe] Type synonyms considered harmful? In-Reply-To: References: <54BAB2A8.1070504@posteo.de> <20150119020556.GC16519@nanodesu.localdomain> Message-ID: <20150121163204.GB22909@nanodesu.localdomain> > Now we're definitely getting somewhere! I'm not to thrilled about the use > of string literals though. How about this? > > {-# LANGUAGE TypeOperators, DataKinds, RankNTypes #-} > type (l ? t) = t > > foo :: forall red green blue. (red ? Double) -> (green ? Double) -> (blue ? > Double) -> IO () > > We just need to patch hlint to make this the suggested style. > > - jeremy In fact, why even bother with the explicit forall? Default behavior is to universally quantify unused variable names, after all. {-# LANGUAGE TypeOperators #-} type (l ? t) = t foo :: (red ? Double) -> (green ? Double) -> (blue ? Double) -> IO () At this point, I think this is a syntax form we can surely all agree upon. From hjgtuyl at chello.nl Wed Jan 21 19:22:20 2015 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Wed, 21 Jan 2015 20:22:20 +0100 Subject: [Haskell-cafe] cabal-install crashes Message-ID: L.S., On my Windows PC, cabal-install crashes each time a file must be downloaded, i.e. when I try to install a package that is not in the cache and when I give command "cabal update". I deleted the file %appdata%\cabal\config to make sure it is not the cause of this crash. I tried several versions of cabal-install, the Haskell Platform I use is 2014.2.0.0. How can I solve this? Regards, Henk-Jan van Tuyl -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From kc1956 at gmail.com Wed Jan 21 20:14:32 2015 From: kc1956 at gmail.com (KC) Date: Wed, 21 Jan 2015 12:14:32 -0800 Subject: [Haskell-cafe] cabal-install crashes In-Reply-To: References: Message-ID: Is your Haskell installation outside of the Program Files folder? Windows has special protections on this folder. Note: Python defaults to installing to the root folder. -- -- Sent from an expensive device which will be obsolete in a few months! :D Casey On Jan 21, 2015 11:22 AM, "Henk-Jan van Tuyl" wrote: > > L.S., > > On my Windows PC, cabal-install crashes each time a file must be > downloaded, i.e. when I try to install a package that is not in the cache > and when I give command "cabal update". I deleted the file > %appdata%\cabal\config to make sure it is not the cause of this crash. I > tried several versions of cabal-install, the Haskell Platform I use is > 2014.2.0.0. > > How can I solve this? > > Regards, > Henk-Jan van Tuyl > > > -- > Folding at home > What if you could share your unused computer power to help find a cure? In > just 5 minutes you can join the world's biggest networked computer and get > us closer sooner. Watch the video. > http://folding.stanford.edu/ > > > http://Van.Tuyl.eu/ > http://members.chello.nl/hjgtuyl/tourdemonad.html > Haskell programming > -- > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chrisdone at gmail.com Wed Jan 21 20:44:54 2015 From: chrisdone at gmail.com (Christopher Done) Date: Wed, 21 Jan 2015 21:44:54 +0100 Subject: [Haskell-cafe] Type synonyms considered harmful? In-Reply-To: <20150121163204.GB22909@nanodesu.localdomain> References: <54BAB2A8.1070504@posteo.de> <20150119020556.GC16519@nanodesu.localdomain> <20150121163204.GB22909@nanodesu.localdomain> Message-ID: That's pretty but a pain to type. On 21 January 2015 at 16:32, Niklas Haas wrote: > > Now we're definitely getting somewhere! I'm not to thrilled about the use > > of string literals though. How about this? > > > > {-# LANGUAGE TypeOperators, DataKinds, RankNTypes #-} > > type (l ? t) = t > > > > foo :: forall red green blue. (red ? Double) -> (green ? Double) -> > (blue ? > > Double) -> IO () > > > > We just need to patch hlint to make this the suggested style. > > > > - jeremy > > In fact, why even bother with the explicit forall? Default behavior is > to universally quantify unused variable names, after all. > > {-# LANGUAGE TypeOperators #-} > > type (l ? t) = t > > foo :: (red ? Double) -> (green ? Double) -> (blue ? Double) -> IO () > > At this point, I think this is a syntax form we can surely all agree upon. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vogt.adam at gmail.com Wed Jan 21 22:30:58 2015 From: vogt.adam at gmail.com (adam vogt) Date: Wed, 21 Jan 2015 17:30:58 -0500 Subject: [Haskell-cafe] Type synonyms considered harmful? In-Reply-To: <20150119020556.GC16519@nanodesu.localdomain> References: <54BAB2A8.1070504@posteo.de> <20150119020556.GC16519@nanodesu.localdomain> Message-ID: > Clearly needs more TypeOperators. > > type (l ? t) = t > > foo :: ("red" ? Double) -> ("green" ? Double) -> ("blue" ? Double) -> IO () That looks similar to an earlier proposal: https://www.haskell.org/pipermail/haskell-cafe/2012-December/105494.html which doesn't seem to have caught on. From amindfv at gmail.com Thu Jan 22 00:23:43 2015 From: amindfv at gmail.com (amindfv at gmail.com) Date: Wed, 21 Jan 2015 19:23:43 -0500 Subject: [Haskell-cafe] Type synonyms considered harmful? In-Reply-To: <20150121163204.GB22909@nanodesu.localdomain> References: <54BAB2A8.1070504@posteo.de> <20150119020556.GC16519@nanodesu.localdomain> <20150121163204.GB22909@nanodesu.localdomain> Message-ID: Considering it doesnt give you any type safety, why not just write: foo (red :: Double) (green :: Double) (blue :: Double) = undefined Tom El Jan 21, 2015, a las 10:32, Niklas Haas escribi?: >> Now we're definitely getting somewhere! I'm not to thrilled about the use >> of string literals though. How about this? >> >> {-# LANGUAGE TypeOperators, DataKinds, RankNTypes #-} >> type (l ? t) = t >> >> foo :: forall red green blue. (red ? Double) -> (green ? Double) -> (blue ? >> Double) -> IO () >> >> We just need to patch hlint to make this the suggested style. >> >> - jeremy > > In fact, why even bother with the explicit forall? Default behavior is > to universally quantify unused variable names, after all. > > {-# LANGUAGE TypeOperators #-} > > type (l ? t) = t > > foo :: (red ? Double) -> (green ? Double) -> (blue ? Double) -> IO () > > At this point, I think this is a syntax form we can surely all agree upon. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From chrisdone at gmail.com Thu Jan 22 00:29:25 2015 From: chrisdone at gmail.com (Christopher Done) Date: Thu, 22 Jan 2015 01:29:25 +0100 Subject: [Haskell-cafe] Type synonyms considered harmful? In-Reply-To: References: <54BAB2A8.1070504@posteo.de> <20150119020556.GC16519@nanodesu.localdomain> <20150121163204.GB22909@nanodesu.localdomain> Message-ID: Because that wouldn't show up in haddock or :t. On 22 January 2015 at 01:23, wrote: > Considering it doesnt give you any type safety, why not just write: > > foo (red :: Double) (green :: Double) (blue :: Double) = undefined > > Tom > > > El Jan 21, 2015, a las 10:32, Niklas Haas > escribi?: > > >> Now we're definitely getting somewhere! I'm not to thrilled about the > use > >> of string literals though. How about this? > >> > >> {-# LANGUAGE TypeOperators, DataKinds, RankNTypes #-} > >> type (l ? t) = t > >> > >> foo :: forall red green blue. (red ? Double) -> (green ? Double) -> > (blue ? > >> Double) -> IO () > >> > >> We just need to patch hlint to make this the suggested style. > >> > >> - jeremy > > > > In fact, why even bother with the explicit forall? Default behavior is > > to universally quantify unused variable names, after all. > > > > {-# LANGUAGE TypeOperators #-} > > > > type (l ? t) = t > > > > foo :: (red ? Double) -> (green ? Double) -> (blue ? Double) -> IO () > > > > At this point, I think this is a syntax form we can surely all agree > upon. > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From magicloud.magiclouds at gmail.com Thu Jan 22 03:00:17 2015 From: magicloud.magiclouds at gmail.com (Magicloud Magiclouds) Date: Thu, 22 Jan 2015 11:00:17 +0800 Subject: [Haskell-cafe] Could cabal-install shows dependencies as dot or some format? Message-ID: Hi, I know ghc-pkg could do that. But that is for packages already installed. I'd like cabal-install to do that when it is trying to resolve dependencies. The reason is that, now I got a "Could not resolve dependencies" error. But I could not simply figure out why based on the output of cabal-install. -- ??????? ??????? And for G+, please use magiclouds#gmail.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dstcruz at gmail.com Thu Jan 22 05:01:54 2015 From: dstcruz at gmail.com (Daniel Santa Cruz) Date: Wed, 21 Jan 2015 22:01:54 -0700 Subject: [Haskell-cafe] Haskell Weekly News: Issue 315 Message-ID: Welcome to issue 315 of the HWN, an issue covering crowd-sourced bits of information about Haskell from around the web. This issue covers from January 4 to 17, 2015 Quotes of the Week * mpickering: When is the right time to use Data.ByteString.Char8? edwardk: mpickering: some time around 1980 * tpolecat: any lecture by conal elliott has that flavor. he is the bob ross of functional programming. Top Reddit Stories * Write You a Haskell Domain: dev.stephendiehl.com, Score: 280, Comments: 24 Original: [1] http://goo.gl/isSXWc On Reddit: [2] http://goo.gl/kOevyS * Announcing LTS Haskell 1.0 Domain: fpcomplete.com, Score: 87, Comments: 14 Original: [3] http://goo.gl/QW25bK On Reddit: [4] http://goo.gl/PlWgfm * MSFT open sources production serialization system written partially in Haskell Domain: blog.nullspace.io, Score: 83, Comments: 6 Original: [5] http://goo.gl/SDm7i1 On Reddit: [6] http://goo.gl/wljTKD * haskell-emacs - Write Emacs extensions in Haskell Domain: github.com, Score: 64, Comments: 3 Original: [7] http://goo.gl/NkK9FE On Reddit: [8] http://goo.gl/75zURt * The Type Theory Podcast, Episode 3: Dan Licata on Homotopy Type Theory Domain: typetheorypodcast.com, Score: 58, Comments: 17 Original: [9] http://goo.gl/z30wH5 On Reddit: [10] http://goo.gl/5KDPNu * Cabal 1.22 and cabal-install 1.22 Domain: groups.google.com, Score: 54, Comments: 3 Original: [11] http://goo.gl/WdxPu0 On Reddit: [12] http://goo.gl/ih07XV * [Haskell-cafe] The amount of CPP we have to use is getting out of hand Domain: haskell.org, Score: 51, Comments: 94 Original: [13] http://goo.gl/0OYZ7C On Reddit: [14] http://goo.gl/4QCAIc * Boston Haskell lightning talks: Rust, Phantoms, ATS, Freezing, Music, and Code reuse Domain: self.haskell, Score: 50, Comments: 8 Original: [15] http://goo.gl/TAjkMi On Reddit: [16] http://goo.gl/TAjkMi * Haskell for all: total-1.0.0: Exhaustive pattern matching using traversals, prisms, and lenses Domain: haskellforall.com, Score: 47, Comments: 9 Original: [17] http://goo.gl/TJDioE On Reddit: [18] http://goo.gl/sx7aMu * Mutation analysis for Haskell (alpha) Domain: self.haskell, Score: 46, Comments: 9 Original: [19] http://goo.gl/MByMzL On Reddit: [20] http://goo.gl/MByMzL * Simple Algebraic Data Types by Bartosz Milewski Domain: bartoszmilewski.com, Score: 45, Comments: 1 Original: [21] http://goo.gl/Ns3UjL On Reddit: [22] http://goo.gl/uuqCt2 * The Frank programming language Domain: homepages.inf.ed.ac.uk, Score: 42, Comments: 29 Original: [23] http://goo.gl/msxrp5 On Reddit: [24] http://goo.gl/0NPQYY * GHC Weekly News - 2015/01/07 Domain: ghc.haskell.org, Score: 42, Comments: 3 Original: [25] http://goo.gl/HVsDLU On Reddit: [26] http://goo.gl/JiMf4b * The Rust community grapples with the menace of ORPHAN INSTANCES Domain: discuss.rust-lang.org, Score: 42, Comments: 19 Original: [27] http://goo.gl/HIl68S On Reddit: [28] http://goo.gl/dUWa48 * The state and future of supercompilation in GHC. Domain: self.haskell, Score: 39, Comments: 10 Original: [29] http://goo.gl/e9FDLV On Reddit: [30] http://goo.gl/e9FDLV Top StackOverflow Questions * Implementation of null function votes: 18, answers: 2 Read on SO: [31] http://goo.gl/cVqJa3 * What is the type of this self-applying factorial function? votes: 17, answers: 3 Read on SO: [32] http://goo.gl/vQaeQ0 * Haskell fast concurrent queue votes: 17, answers: 3 Read on SO: [33] http://goo.gl/HdAlul * Ghc: partially compile Haskell code? votes: 13, answers: 1 Read on SO: [34] http://goo.gl/hS2QNQ * What is the type of return 5 in Haskell when no context is given? votes: 12, answers: 1 Read on SO: [35] http://goo.gl/IC08Sk * Is it possible to write fmap for this data type involving a type family? votes: 11, answers: 1 Read on SO: [36] http://goo.gl/6V5Mps * How to get cabal and nix work together votes: 11, answers: 1 Read on SO: [37] http://goo.gl/TOXNDv * What is the most general way to compute the depth of a tree with something like a fold? votes: 8, answers: 2 Read on SO: [38] http://goo.gl/vlcioF * What is exactly an indexed functor in Haskell and what are its usages? votes: 8, answers: 1 Read on SO: [39] http://goo.gl/10PK8U * Functor instance for generic polymorphic ADTs in Haskell? votes: 8, answers: 2 Read on SO: [40] http://goo.gl/Oh0uFp * Finite State Transducers in Haskell? votes: 7, answers: 1 Read on SO: [41] http://goo.gl/gu80ZL * Is it possible to encode a generic ?lift? function in Haskell? votes: 7, answers: 2 Read on SO: [42] http://goo.gl/R9B8N5 * Haskell Expression Equivalents votes: 6, answers: 1 Read on SO: [43] http://goo.gl/t54YiS Until next time, [44]+Daniel Santa Cruz References 1. http://dev.stephendiehl.com/fun/ 2. http://www.reddit.com/r/haskell/comments/2regln/write_you_a_haskell/ 3. https://www.fpcomplete.com/blog/2015/01/announcing-lts-haskell-1-0 4. http://www.reddit.com/r/haskell/comments/2rapgt/announcing_lts_haskell_10/ 5. http://blog.nullspace.io/bond-oss.html 6. http://www.reddit.com/r/haskell/comments/2rxkmk/msft_open_sources_production_serialization_system/ 7. https://github.com/knupfer/haskell-emacs 8. http://www.reddit.com/r/haskell/comments/2sdvyu/haskellemacs_write_emacs_extensions_in_haskell/ 9. http://typetheorypodcast.com/2015/01/episode-3-dan-licata-on-homotopy-type-theory/ 10. http://www.reddit.com/r/haskell/comments/2rnumy/the_type_theory_podcast_episode_3_dan_licata_on/ 11. https://groups.google.com/forum/#!msg/haskell-cafe/rRbP9oJjOBc/J8lf_sGVl_oJ 12. http://www.reddit.com/r/haskell/comments/2rcuak/cabal_122_and_cabalinstall_122/ 13. https://www.haskell.org/pipermail/haskell-cafe/2015-January/117683.html 14. http://www.reddit.com/r/haskell/comments/2shv2d/haskellcafe_the_amount_of_cpp_we_have_to_use_is/ 15. http://www.reddit.com/r/haskell/comments/2sn8la/boston_haskell_lightning_talks_rust_phantoms_ats/ 16. http://www.reddit.com/r/haskell/comments/2sn8la/boston_haskell_lightning_talks_rust_phantoms_ats/ 17. http://www.haskellforall.com/2015/01/total-100-exhaustive-pattern-matching.html 18. http://www.reddit.com/r/haskell/comments/2s1tfx/haskell_for_all_total100_exhaustive_pattern/ 19. http://www.reddit.com/r/haskell/comments/2rj5sw/mutation_analysis_for_haskell_alpha/ 20. http://www.reddit.com/r/haskell/comments/2rj5sw/mutation_analysis_for_haskell_alpha/ 21. http://bartoszmilewski.com/2015/01/13/simple-algebraic-data-types/ 22. http://www.reddit.com/r/haskell/comments/2sbl93/simple_algebraic_data_types_by_bartosz_milewski/ 23. http://homepages.inf.ed.ac.uk/slindley/papers/frankly-draft-march2014.pdf 24. http://www.reddit.com/r/haskell/comments/2rao0t/the_frank_programming_language/ 25. https://ghc.haskell.org/trac/ghc/blog/weekly20150107 26. http://www.reddit.com/r/haskell/comments/2rq6zc/ghc_weekly_news_20150107/ 27. http://discuss.rust-lang.org/t/orphan-rules/1322/4 28. http://www.reddit.com/r/haskell/comments/2shyfj/the_rust_community_grapples_with_the_menace_of/ 29. http://www.reddit.com/r/haskell/comments/2s97d0/the_state_and_future_of_supercompilation_in_ghc/ 30. http://www.reddit.com/r/haskell/comments/2s97d0/the_state_and_future_of_supercompilation_in_ghc/ 31. http://stackoverflow.com/questions/27941690/implementation-of-null-function 32. http://stackoverflow.com/questions/27814714/what-is-the-type-of-this-self-applying-factorial-function 33. http://stackoverflow.com/questions/27933941/haskell-fast-concurrent-queue 34. http://stackoverflow.com/questions/27780282/ghc-partially-compile-haskell-code 35. http://stackoverflow.com/questions/27932794/what-is-the-type-of-return-5-in-haskell-when-no-context-is-given 36. http://stackoverflow.com/questions/27936725/is-it-possible-to-write-fmap-for-this-data-type-involving-a-type-family 37. http://stackoverflow.com/questions/27968909/how-to-get-cabal-and-nix-work-together 38. http://stackoverflow.com/questions/27769688/what-is-the-most-general-way-to-compute-the-depth-of-a-tree-with-something-like 39. http://stackoverflow.com/questions/27771474/what-is-exactly-an-indexed-functor-in-haskell-and-what-are-its-usages 40. http://stackoverflow.com/questions/27856974/functor-instance-for-generic-polymorphic-adts-in-haskell 41. http://stackoverflow.com/questions/27997155/finite-state-transducers-in-haskell 42. http://stackoverflow.com/questions/28003135/is-it-possible-to-encode-a-generic-lift-function-in-haskell 43. http://stackoverflow.com/questions/27761821/haskell-expression-equivalents 44. https://plus.google.com/105107667630152149014/about -------------- next part -------------- An HTML attachment was scrubbed... URL: From hjgtuyl at chello.nl Thu Jan 22 11:14:53 2015 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Thu, 22 Jan 2015 12:14:53 +0100 Subject: [Haskell-cafe] [Haskell] Haskell Weekly News: Issue 315 In-Reply-To: References: Message-ID: On Thu, 22 Jan 2015 06:01:54 +0100, Daniel Santa Cruz wrote: > * tpolecat: any lecture by conal elliott has that flavor. he is the > bob ross of functional programming. ... maybe a happy little monad here ... :) (If you haven't seen Bob Ross yet: https://www.youtube.com/watch?v=OwJoNqk8MeM ) Regards, Henk-Jan van Tuyl -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From onepoint at starurchin.org Thu Jan 22 20:41:43 2015 From: onepoint at starurchin.org (Jeremy Henty) Date: Thu, 22 Jan 2015 20:41:43 +0000 Subject: [Haskell-cafe] hs-fltk build fails Message-ID: <20150122204143.GA3963@omphalos.singularity> I am building with " cabal sandbox init ; cabal install hs-fltk ". Logs attached. Any advice? Regards, Jeremy Henty -------------- next part -------------- package: hs-fltk-0.2.5 os: linux arch: i386 compiler: ghc-7.8.4 client: cabal-install-1.22.0.0 dependencies: base-4.7.0.2 install-outcome: BuildFailed docs-outcome: NotTried tests-outcome: NotTried package: hs-fltk-0.2.5 os: linux arch: i386 compiler: ghc-7.8.4 client: cabal-install-1.22.0.0 dependencies: base-4.7.0.2 install-outcome: BuildFailed docs-outcome: NotTried tests-outcome: NotTried package: hs-fltk-0.2.5 os: linux arch: i386 compiler: ghc-7.8.4 client: cabal-install-1.22.0.0 dependencies: base-4.7.0.2 install-outcome: BuildFailed docs-outcome: NotTried tests-outcome: NotTried -------------- next part -------------- Configuring hs-fltk-0.2.5... Building hs-fltk-0.2.5... Preprocessing library hs-fltk-0.2.5... [ 1 of 12] Compiling Graphics.UI.FLTK.Widget ( src/Graphics/UI/FLTK/Widget.hs, dist/dist-sandbox-7ea82ab6/build/Graphics/UI/FLTK/Widget.o ) src/Graphics/UI/FLTK/Widget.hs:20:1: Warning: The import of ?Foreign.StablePtr? is redundant except perhaps to import instances from ?Foreign.StablePtr? To import instances alone, use: import Foreign.StablePtr() src/Graphics/UI/FLTK/Widget.hs:37:21: Warning: Defined but not used: ?g? src/Graphics/UI/FLTK/Widget.hs:110:1: Warning: Top-level binding with no type signature: wNever :: When src/Graphics/UI/FLTK/Widget.hs:112:1: Warning: Top-level binding with no type signature: wChanged :: When src/Graphics/UI/FLTK/Widget.hs:114:1: Warning: Top-level binding with no type signature: wRelease :: When src/Graphics/UI/FLTK/Widget.hs:116:1: Warning: Top-level binding with no type signature: wReleaseAllways :: When src/Graphics/UI/FLTK/Widget.hs:118:1: Warning: Top-level binding with no type signature: wEnter :: When src/Graphics/UI/FLTK/Widget.hs:120:1: Warning: Top-level binding with no type signature: wEnterAllways :: When src/Graphics/UI/FLTK/Widget.hs:122:1: Warning: Top-level binding with no type signature: wEnterChanged :: When src/Graphics/UI/FLTK/Widget.hs:124:1: Warning: Top-level binding with no type signature: wNotChanged :: When src/Graphics/UI/FLTK/Widget.hs:142:1: Warning: Top-level binding with no type signature: callbackHandler :: forall t. t -> StablePtr (t -> IO ()) -> IO () src/Graphics/UI/FLTK/Widget.hs:152:1: Warning: Defined but not used: ?nothing? src/Graphics/UI/FLTK/Widget.hs:152:1: Warning: Top-level binding with no type signature: nothing :: forall t (m :: * -> *). Monad m => t -> m () src/Graphics/UI/FLTK/Widget.hs:164:1: Warning: Top-level binding with no type signature: black :: Color src/Graphics/UI/FLTK/Widget.hs:165:1: Warning: Top-level binding with no type signature: red :: Color src/Graphics/UI/FLTK/Widget.hs:166:1: Warning: Top-level binding with no type signature: green :: Color src/Graphics/UI/FLTK/Widget.hs:167:1: Warning: Top-level binding with no type signature: yellow :: Color src/Graphics/UI/FLTK/Widget.hs:168:1: Warning: Top-level binding with no type signature: blue :: Color src/Graphics/UI/FLTK/Widget.hs:169:1: Warning: Top-level binding with no type signature: magenta :: Color src/Graphics/UI/FLTK/Widget.hs:170:1: Warning: Top-level binding with no type signature: cyan :: Color src/Graphics/UI/FLTK/Widget.hs:171:1: Warning: Top-level binding with no type signature: white :: Color src/Graphics/UI/FLTK/Widget.hs:228:1: Warning: Top-level binding with no type signature: getCoords :: Ptr Widget -> Ptr Int -> IO (Int, Int, Int, Int) src/Graphics/UI/FLTK/Widget.hs:229:25: Warning: This binding for ?w? shadows the existing binding bound at src/Graphics/UI/FLTK/Widget.hs:228:11 [ 2 of 12] Compiling Graphics.UI.FLTK.Menu ( src/Graphics/UI/FLTK/Menu.hs, dist/dist-sandbox-7ea82ab6/build/Graphics/UI/FLTK/Menu.o ) src/Graphics/UI/FLTK/Menu.hs:19:29: Warning: This binding for ?w? shadows the existing binding bound at src/Graphics/UI/FLTK/Menu.hs:19:16 src/Graphics/UI/FLTK/Menu.hs:31:6: Warning: Defined but not used: ?mb? src/Graphics/UI/FLTK/Menu.hs:35:9: Warning: This binding for ?label? shadows the existing binding imported from ?Graphics.UI.FLTK.Widget? at src/Graphics/UI/FLTK/Menu.hs:12:1-30 (and originally defined at src/Graphics/UI/FLTK/Widget.hs:87:1-5) src/Graphics/UI/FLTK/Menu.hs:41:1: Warning: Top-level binding with no type signature: mDefault :: MenuType src/Graphics/UI/FLTK/Menu.hs:42:1: Warning: Top-level binding with no type signature: mInactive :: MenuType src/Graphics/UI/FLTK/Menu.hs:43:1: Warning: Top-level binding with no type signature: mToggle :: MenuType src/Graphics/UI/FLTK/Menu.hs:44:1: Warning: Top-level binding with no type signature: mValue :: MenuType src/Graphics/UI/FLTK/Menu.hs:45:1: Warning: Top-level binding with no type signature: mRadio :: MenuType src/Graphics/UI/FLTK/Menu.hs:46:1: Warning: Top-level binding with no type signature: mInvisible :: MenuType src/Graphics/UI/FLTK/Menu.hs:47:1: Warning: Top-level binding with no type signature: mDivider :: MenuType [ 3 of 12] Compiling Graphics.UI.FLTK.Input ( src/Graphics/UI/FLTK/Input.hs, dist/dist-sandbox-7ea82ab6/build/Graphics/UI/FLTK/Input.o ) src/Graphics/UI/FLTK/Input.hs:21:10: Illegal instance declaration for ?Value_FC Input String? (All instance types must be of the form (T a1 ... an) where a1 ... an are *distinct type variables*, and each type variable appears at most once in the instance head. Use FlexibleInstances if you want to disable this.) In the instance declaration for ?Value_FC Input String? From winterkoninkje at gmail.com Thu Jan 22 23:03:41 2015 From: winterkoninkje at gmail.com (wren romano) Date: Thu, 22 Jan 2015 18:03:41 -0500 Subject: [Haskell-cafe] Help with identity functor print instance and monad transformers In-Reply-To: References: Message-ID: On Tue, Jan 20, 2015 at 12:09 AM, Cody Goodman wrote: > I understand the error below, but I'm not really sure what an instance of > liftIO would look like for the Identity functor. I guess I'm not all to > clear on what an identity functor is. > > I'm a little fuzzy on what an identity monad is. I understand that id gives > the identity of something back pretty well though. Can anyone help? The identity functor/monad is this: newtype Identity a = Identity { runIdentity :: a } That is, the type constructor `Identity` works like the function `id`, but on the type level. It doesn't add any sort of special effects, it just gives us a type constructor that we can use whenever we need something of kind * -> *, like when working with monad transformer stacks. Identity is trivially a monad: instance Functor Identity where fmap f (Identity x) = Identity (f x) instance Applicative Identity where pure x = Identity x Identity f <*> Identity x = Identity (f x) instance Monad Identity where return x = Identity x Identity x >>= f = f x If we erase all the newtype un/wrapping, then we can see that all these functions are just variations on ($) and `id`. That's why we say it's trivial. -- Live well, ~wren From codygman.consulting at gmail.com Thu Jan 22 23:31:39 2015 From: codygman.consulting at gmail.com (Cody Goodman) Date: Thu, 22 Jan 2015 17:31:39 -0600 Subject: [Haskell-cafe] Help with identity functor print instance and monad transformers In-Reply-To: References: Message-ID: Thanks for the help! On Jan 22, 2015 5:03 PM, "wren romano" wrote: > On Tue, Jan 20, 2015 at 12:09 AM, Cody Goodman > wrote: > > I understand the error below, but I'm not really sure what an instance of > > liftIO would look like for the Identity functor. I guess I'm not all to > > clear on what an identity functor is. > > > > I'm a little fuzzy on what an identity monad is. I understand that id > gives > > the identity of something back pretty well though. Can anyone help? > > The identity functor/monad is this: > > newtype Identity a = Identity { runIdentity :: a } > > That is, the type constructor `Identity` works like the function `id`, > but on the type level. It doesn't add any sort of special effects, it > just gives us a type constructor that we can use whenever we need > something of kind * -> *, like when working with monad transformer > stacks. > > Identity is trivially a monad: > > instance Functor Identity where > fmap f (Identity x) = Identity (f x) > > instance Applicative Identity where > pure x = Identity x > Identity f <*> Identity x = Identity (f x) > > instance Monad Identity where > return x = Identity x > Identity x >>= f = f x > > If we erase all the newtype un/wrapping, then we can see that all > these functions are just variations on ($) and `id`. That's why we say > it's trivial. > > -- > Live well, > ~wren > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bog at khumba.net Thu Jan 22 23:34:35 2015 From: bog at khumba.net (Bryan Gardiner) Date: Thu, 22 Jan 2015 15:34:35 -0800 Subject: [Haskell-cafe] Overlapping instances with "instance F a => G a" In-Reply-To: References: <20150101132959.7fb38004@khumba.net> Message-ID: <20150122153435.784440b8@khumba.net> On Thu, 1 Jan 2015 17:15:31 -0500 Brandon Allbery wrote: > On Thu, Jan 1, 2015 at 4:29 PM, Bryan Gardiner wrote: > > > Doesn't "HostBinaryNum a => HostBinary a" create a HostBinary instance > > for all instances of HostBinaryNum only? So why would it cause > > > > No, it creates an instance for all types, then checks for HostBinaryNum at > the point where it tries to use the instance. Brandon, Tom, thanks for the reponses. I can only claim rudimentary typeclass knowledge but I find it odd for the instance statement to create instances for all types if it's going to only be usable for types with HostBinaryNum instances. From my reading of the GHC manual, it's generally only an error when a conflict actually occurs, not if a conflict might occur. Is there a benefit to having it this way? Many thanks, Bryan -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: From codygman.consulting at gmail.com Fri Jan 23 04:04:44 2015 From: codygman.consulting at gmail.com (Cody Goodman) Date: Thu, 22 Jan 2015 22:04:44 -0600 Subject: [Haskell-cafe] Creating a list with do notation Message-ID: List is a monad, does that mean i can create a list with do notation? My intuition led me to believe this would work: main = do x <- return $ do 1 2 3 print (x :: [Int]) However it didn't. Is this possible? -------------- next part -------------- An HTML attachment was scrubbed... URL: From reilithion at gmail.com Fri Jan 23 04:24:50 2015 From: reilithion at gmail.com (Lucas Paul) Date: Thu, 22 Jan 2015 21:24:50 -0700 Subject: [Haskell-cafe] Creating a list with do notation In-Reply-To: References: Message-ID: Yes, but it might not work quite the way you expect: Prelude> do { a <- [1]; (a:[2]) } [1,2] Prelude> do { a <- [1]; b <- (a:[2]); (b:[3]) } [1,3,2,3] - Lucas Paul On Thu, Jan 22, 2015 at 9:04 PM, Cody Goodman wrote: > List is a monad, does that mean i can create a list with do notation? > > My intuition led me to believe this would work: > > main = do > x <- return $ do > 1 > 2 > 3 > print (x :: [Int]) > > > However it didn't. Is this possible? > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From maydwell at gmail.com Fri Jan 23 04:28:23 2015 From: maydwell at gmail.com (Lyndon Maydwell) Date: Fri, 23 Jan 2015 15:28:23 +1100 Subject: [Haskell-cafe] Creating a list with do notation In-Reply-To: References: Message-ID: The items in your do-block must be in the same monad as you're operating in - in this example - the list monad: main = do x <- return $ do [ 1 ] [ 2 ] [ 3 ] print (x :: [Int]) Unfortunately, there is no accumulation of items. You can reason this out if you desugar the do-notation into binds: [ 1 ] >> [ 2 ] >> [ 3 ] [ 1 ] >>= (\x -> [ 2 ] >>= (\y -> [ 3 ])) and then examine the list Monad instance. You can achieve something similar to what you're looking for with the writer monad: import Control.Monad.Writer.Lazy main = do x <- return $ execWriter $ do tell [1] tell [2] tell [3] print (x :: [Int]) On Fri, Jan 23, 2015 at 3:04 PM, Cody Goodman wrote: > List is a monad, does that mean i can create a list with do notation? > > My intuition led me to believe this would work: > > main = do > x <- return $ do > 1 > 2 > 3 > print (x :: [Int]) > > > However it didn't. Is this possible? > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From briand at aracnet.com Fri Jan 23 05:41:04 2015 From: briand at aracnet.com (briand at aracnet.com) Date: Thu, 22 Jan 2015 21:41:04 -0800 Subject: [Haskell-cafe] hs-fltk build fails In-Reply-To: <20150122204143.GA3963@omphalos.singularity> References: <20150122204143.GA3963@omphalos.singularity> Message-ID: <20150122214104.7d8af907@cedar.deldotd.com> On Thu, 22 Jan 2015 20:41:43 +0000 Jeremy Henty wrote: > > I am building with " cabal sandbox init ; cabal install hs-fltk ". > Logs attached. Any advice? > The only problem i had (other than i was missing a lot of graphics libraries) was needing to use fltk 1.3.3. There's a link on the instruction page. I'm not sure that will fix your problem, but i definitely had some issues which were fixed by using that particular version even though i had 1.3 installed. Brian From erkokl at gmail.com Fri Jan 23 06:31:38 2015 From: erkokl at gmail.com (Levent Erkok) Date: Thu, 22 Jan 2015 22:31:38 -0800 Subject: [Haskell-cafe] [ANNOUNCE] New release of SBV Message-ID: I'm happy to announce a new release of SBV (v4.0); a library for seamlessly integrating SMT solvers with Haskell. https://hackage.haskell.org/package/sbv Most of the changes in this release are due to Brian Huffman of Galois; essentially adding capabilities so end-users can define symbolic bit-vector types that are not natively supported by SBV. For instance, a user can define `SWord17` for representing 17-bit words and use them just like other symbolic types natively supported by SBV. This feature allows SBV to take advantage of arbitrary bit-size decision procedures for bit-vector logics as found in modern SMT solvers, which are becoming increasingly more valuable in (semi-)automated verification of software artifacts. (Note that SBV already supports other basic types such as unbounded Integers, IEEE Floats and Doubles, Rationals, Algebraic reals, and traditional machine word sizes such as Word8/Int8; 16; 32; and 64 symbolically.) We plan to also add automatic support for SWordN/SIntN for arbitrary N, once GHC gets proper support for type-level naturals. Thanks to Brian Huffman for his contributions to this release. Bug reports/comments are always welcome. -Levent. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hjgtuyl at chello.nl Fri Jan 23 07:59:01 2015 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Fri, 23 Jan 2015 08:59:01 +0100 Subject: [Haskell-cafe] Unacceptable argument type in foreign declaration: Ptr () Message-ID: L.S., I am trying to compile a package that hasn't been updated since 2009 and I get a lot of messages like: Unacceptable argument type in foreign declaration: Ptr () When checking declaration: foreign import stdcall safe "dynamic" prim_System_Win32_Com_Automation_TypeLib_setGuid :: Ptr () -> Ptr () -> Ptr GUID -> IO Int32 How can I correct this? Regards, Henk-Jan van Tuyl -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From rf at rufflewind.com Fri Jan 23 09:35:37 2015 From: rf at rufflewind.com (Phil Ruffwind) Date: Fri, 23 Jan 2015 04:35:37 -0500 Subject: [Haskell-cafe] Type synonyms considered harmful? In-Reply-To: References: <54BAB2A8.1070504@posteo.de> <54BCD965.6030608@k-hornz.de> Message-ID: > But in a public library, finding out that a type X is actually 'Either z' > kind of blocks the way It does. It's quite annoying to have to jump through several layers of indirections especially since (currently) Haddock-generated documentation requires you to click through the link to see what it's aliased to (a mouseover tooltip would be really nice to have!). I would rather just document each parameter using the `-- ^` syntax. From arunram.atma at gmail.com Fri Jan 23 10:57:16 2015 From: arunram.atma at gmail.com (Arunram A) Date: Fri, 23 Jan 2015 02:57:16 -0800 (PST) Subject: [Haskell-cafe] HDBC installation error Message-ID: Hi, I am trying to install HDBC, using the following command. cabal install hdbc and getting the following error. Preprocessing library HDBC-2.4.0.0... [1 of 8] Compiling Database.HDBC.Locale ( Database\HDBC\Locale.hs, dist\build\Database\HDBC\Locale.o ) [2 of 8] Compiling Database.HDBC.SqlValue ( Database\HDBC\SqlValue.hs, dist\build\Database\HDBC\SqlValue.o ) Database\HDBC\SqlValue.hs:265:29: Ambiguous occurrence `defaultTimeLocale' It could refer to either `Data.Time.defaultTimeLocale', imported from `Data.Time' at Database\HDBC\SqlValue.hs:20:1-16 (and originally defined in `time-1.5:Data.Time.Form at.Locale') or `Database.HDBC.Locale.defaultTimeLocale', imported from `Database.HDBC.Locale' at Database\HDBC\SqlValue.hs:22:30-46 (and originally defined in `System.Locale') Seems to be some kind of import conflict. But, I am not able to identify the problem and resolve the issue. May I get a clarity on what the problem could be and is there a known solution for this? Thanks! Regards, Arunram A. -------------- next part -------------- An HTML attachment was scrubbed... URL: From onepoint at starurchin.org Fri Jan 23 11:40:40 2015 From: onepoint at starurchin.org (Jeremy Henty) Date: Fri, 23 Jan 2015 11:40:40 +0000 Subject: [Haskell-cafe] hs-fltk build fails In-Reply-To: <20150122214104.7d8af907@cedar.deldotd.com> References: <20150122204143.GA3963@omphalos.singularity> <20150122214104.7d8af907@cedar.deldotd.com> Message-ID: <20150123114040.GA30991@omphalos.singularity> briand at aracnet.com wrote: > Jeremy Henty wrote: > > > I am building with " cabal sandbox init ; cabal install hs-fltk ". > > Logs attached. Any advice? > > The only problem i had (other than i was missing a lot of graphics > libraries) was needing to use fltk 1.3.3. I already use fltk 1.3.3. :-( > There's a link on the instruction page. Which page? I can't see it on the hackage project page and the "Home Page" link there gives me "Page not found". :-( :-( The *.cabal says "tested with: GHC==6.8.2". I am using GHC-7.8.4 . The error message suggests enabling FlexibleInstances which isn't in the *.cabal or the *.hs . Regards, Jeremy Henty From aditya.siram at gmail.com Fri Jan 23 12:10:29 2015 From: aditya.siram at gmail.com (aditya siram) Date: Fri, 23 Jan 2015 06:10:29 -0600 Subject: [Haskell-cafe] hs-fltk build fails In-Reply-To: <20150123114040.GA30991@omphalos.singularity> References: <20150122204143.GA3963@omphalos.singularity> <20150122214104.7d8af907@cedar.deldotd.com> <20150123114040.GA30991@omphalos.singularity> Message-ID: Hi Jeremy, I recommend you try 'fltkhs' (http://github.com/deech/fltkhs). It has a larger widget set and is being actively developed. I can also help you if you're having difficulty installing it. -deech On Fri, Jan 23, 2015 at 5:40 AM, Jeremy Henty wrote: > > briand at aracnet.com wrote: > > > Jeremy Henty wrote: > > > > > I am building with " cabal sandbox init ; cabal install hs-fltk ". > > > Logs attached. Any advice? > > > > The only problem i had (other than i was missing a lot of graphics > > libraries) was needing to use fltk 1.3.3. > > I already use fltk 1.3.3. :-( > > > There's a link on the instruction page. > > Which page? I can't see it on the hackage project page and the "Home > Page" link there gives me "Page not found". :-( :-( > > The *.cabal says "tested with: GHC==6.8.2". I am using GHC-7.8.4 . > The error message suggests enabling FlexibleInstances which isn't in > the *.cabal or the *.hs . > > Regards, > > Jeremy Henty > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hesselink at gmail.com Fri Jan 23 13:27:07 2015 From: hesselink at gmail.com (Erik Hesselink) Date: Fri, 23 Jan 2015 14:27:07 +0100 Subject: [Haskell-cafe] HDBC installation error In-Reply-To: References: Message-ID: Hi Arunram, HDBC doesn't work with time 1.5. It does list 1.5 as supported, and it seems I introduced that bug. For now, specifying something like '--constraint=time\<1.5' on the command line might work. Regards, Erik On Fri, Jan 23, 2015 at 11:57 AM, Arunram A wrote: > Hi, > > I am trying to install HDBC, using the following command. > > cabal install hdbc > > and getting the following error. > > Preprocessing library HDBC-2.4.0.0... > [1 of 8] Compiling Database.HDBC.Locale ( Database\HDBC\Locale.hs, > dist\build\Database\HDBC\Locale.o ) > [2 of 8] Compiling Database.HDBC.SqlValue ( Database\HDBC\SqlValue.hs, > dist\build\Database\HDBC\SqlValue.o ) > > Database\HDBC\SqlValue.hs:265:29: > Ambiguous occurrence `defaultTimeLocale' > It could refer to either `Data.Time.defaultTimeLocale', > imported from `Data.Time' at > Database\HDBC\SqlValue.hs:20:1-16 > (and originally defined in > `time-1.5:Data.Time.Form at.Locale') > or `Database.HDBC.Locale.defaultTimeLocale', > imported from `Database.HDBC.Locale' at > Database\HDBC\SqlValue.hs:22:30-46 > (and originally defined in `System.Locale') > > Seems to be some kind of import conflict. But, I am not able to identify > the problem and resolve the issue. > > May I get a clarity on what the problem could be and is there a known > solution for this? > > Thanks! > > Regards, > Arunram A. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From onepoint at starurchin.org Fri Jan 23 13:29:28 2015 From: onepoint at starurchin.org (Jeremy Henty) Date: Fri, 23 Jan 2015 13:29:28 +0000 Subject: [Haskell-cafe] hs-fltk build fails In-Reply-To: References: <20150122204143.GA3963@omphalos.singularity> <20150122214104.7d8af907@cedar.deldotd.com> <20150123114040.GA30991@omphalos.singularity> Message-ID: <20150123132928.GA31841@omphalos.singularity> aditya siram wrote: > I recommend you try 'fltkhs' (http://github.com/deech/fltkhs). It > has a larger widget set and is being actively developed. I can also > help you if you're having difficulty installing it. Is that the project that was recently announced on this list? Then it's the one I *meant* to use. I wondered why I was working with something so old! autoconf fails with ... configure.ac:35: error: possibly undefined macro: AC_CHECK_HEADER_STDBOOL If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. ... but generates a configure script anyway. configure warns ... ./configure: line 3906: AC_CHECK_HEADER_STDBOOL: command not found ... then fails with ... config.status: error: cannot find input file: `config.h.in' autoconf is version 2.68 . FLTK is version 1.3.3 and is detected by configure. Thanks in advance for any help. Regards, Jeremy Henty From aditya.siram at gmail.com Fri Jan 23 13:57:28 2015 From: aditya.siram at gmail.com (aditya siram) Date: Fri, 23 Jan 2015 07:57:28 -0600 Subject: [Haskell-cafe] hs-fltk build fails In-Reply-To: <20150123132928.GA31841@omphalos.singularity> References: <20150122204143.GA3963@omphalos.singularity> <20150122214104.7d8af907@cedar.deldotd.com> <20150123114040.GA30991@omphalos.singularity> <20150123132928.GA31841@omphalos.singularity> Message-ID: Ok, in doing some research it appears as though AC_CHECK_HEADER_STDBOOL is sometimes not installed. Could you delete line 35 in 'configure.ac` and try again? If that works I'll update the docs. Thanks! -deech On Fri, Jan 23, 2015 at 7:29 AM, Jeremy Henty wrote: > > aditya siram wrote: > > > I recommend you try 'fltkhs' (http://github.com/deech/fltkhs). It > > has a larger widget set and is being actively developed. I can also > > help you if you're having difficulty installing it. > > Is that the project that was recently announced on this list? Then > it's the one I *meant* to use. I wondered why I was working with > something so old! > > autoconf fails with ... > > configure.ac:35: error: possibly undefined macro: > AC_CHECK_HEADER_STDBOOL > If this token and others are legitimate, please use > m4_pattern_allow. > See the Autoconf documentation. > > ... but generates a configure script anyway. configure warns ... > > ./configure: line 3906: AC_CHECK_HEADER_STDBOOL: command not found > > ... then fails with ... > > config.status: error: cannot find input file: `config.h.in' > > autoconf is version 2.68 . FLTK is version 1.3.3 and is detected by > configure. > > Thanks in advance for any help. > > Regards, > > Jeremy Henty > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From onepoint at starurchin.org Fri Jan 23 14:20:16 2015 From: onepoint at starurchin.org (Jeremy Henty) Date: Fri, 23 Jan 2015 14:20:16 +0000 Subject: [Haskell-cafe] fltkhs build: WAS: Re: hs-fltk build fails In-Reply-To: References: <20150122204143.GA3963@omphalos.singularity> <20150122214104.7d8af907@cedar.deldotd.com> <20150123114040.GA30991@omphalos.singularity> <20150123132928.GA31841@omphalos.singularity> Message-ID: <20150123142016.GB31841@omphalos.singularity> aditya siram wrote: > Ok, in doing some research it appears as though > AC_CHECK_HEADER_STDBOOL is sometimes not installed. Could you delete > line 35 in 'configure.ac` and try again? If that works I'll update > the docs. Yes, deleting that lines fixes the problems I reported. Thanks for your help! Regards, Jeremy Henty From chneukirchen at gmail.com Fri Jan 23 15:23:17 2015 From: chneukirchen at gmail.com (Christian Neukirchen) Date: Fri, 23 Jan 2015 16:23:17 +0100 Subject: [Haskell-cafe] Munich Haskell Meeting, 2015-01-26 @ 19:30 Message-ID: <873871msgq.fsf@gmail.com> Dear all, Next week, our monthly Munich Haskell Meeting will take place again on Monday, January 26 at Cafe Puck at 19h30. For details see here: http://www.haskell-munich.de/dates If you plan to join, please add yourself to this dudle so we can reserve enough seats! It is OK to add yourself to the dudle anonymously or pseudonymously. https://dudle.inf.tu-dresden.de/haskell-munich-jan-2015/ Everybody is welcome! cu, -- Christian Neukirchen http://chneukirchen.org From rjljr2 at gmail.com Fri Jan 23 15:47:54 2015 From: rjljr2 at gmail.com (Ronald Legere) Date: Fri, 23 Jan 2015 08:47:54 -0700 Subject: [Haskell-cafe] Haskell wiki Message-ID: Greetings, Does anyone know how to get an account to help contribute to the haskell wiki? Registration has been closed for the last 3 years and there is link to email anyone that I could find, hence this "Broadcast" message. There are dead links and such that I would love to help clean up. Cheers! -- Ron Legere (rjljr2 at gmail.com) legere et discere -------------- next part -------------- An HTML attachment was scrubbed... URL: From semen at trygub.com Fri Jan 23 15:49:56 2015 From: semen at trygub.com (Semen Trygubenko / =?utf-8?B?0KHQtdC80LXQvSDQotGA0LjQs9GD0LHQtdC9?= =?utf-8?B?0LrQvg==?=) Date: Fri, 23 Jan 2015 15:49:56 +0000 Subject: [Haskell-cafe] cabal keeps relinking In-Reply-To: <5462635A.1030200@nh2.me> References: <20141107153549.GD64515@inanna.trygub.com> <545D0E14.50306@nh2.me> <20141107200929.GA67778@inanna.trygub.com> <545D36AF.2090208@nh2.me> <20141111120135.GB19364@inanna.trygub.com> <5462635A.1030200@nh2.me> Message-ID: <20150123154956.GA20146@inanna.trygub.com> On Tue, Nov 11, 2014 at 08:28:26PM +0100, Niklas Hamb?chen wrote: > Ok, so it seems like it works on Linux, but not FreeBSD. > > To explain the situation a little bit: > > The compiled object files (.o) are linked together in an archive file > (.a) by the `ar` program (similar to `tar`). > The file entries in the .a file by default contain timestamps of the > files, which usually means the mtime (last modification time). > The build only looks at the .a file as a whole, and if its contents > changed from the last build, it has to relink. Of course if a timestamp > inside the .a changed, that's treated as "the .a file is different". > > Newer versions of `ar` have a -D option to avoid putting the mtimes of > the .o files into the archive. But not all platforms supported by > GHC/cabal support this flag. That's why we implemented a manual method > to wipe the timestamps (set them to 0), so that they can no longer have > an effect on the build. > > Seems like that doesn't work for FreeBSD. That's a shame, because we did > take special care to make sure that it works cross-platform. Thanks for your reply! > You could help debug it: > > First, create an issue on cabal's Github so that we can track the bug, > and explain the problem there and paste the output. Done ? see https://github.com/haskell/cabal/issues/2384 . Also, I've re-run it with the latest cabal cabal-install version 1.22.0.0 using version 1.22.0.0 of the Cabal library and noticed a bit of a difference in behaviour this time. Namely, for the sequence I've ran (as before): cabal clean cabal build cabal test cabal build cabal test There's an improvement in both "cabal test" steps when moving to 1.22 in the sense that the following lines have disappeared from the output: Building cabalTest-0.1.0.0... Preprocessing executable 'cabalTest' for cabalTest-0.1.0.0... Linking dist/build/cabalTest/cabalTest ... (i.e., when running test target the exe itself (named cabalTest) is no longer relinked unnecessarily, only the test for it (named cabalTestTest). However, when compared with old output on Linux there are still some extra relinks present: For the second run of "cabal bulid" I still see Linking dist/build/cabalTest/cabalTest ? Linking dist/build/CabalTestTest/CabalTestTest ? For the second run of "cabal test" I still see Linking dist/build/CabalTestTest/CabalTestTest ... So it seems that the problem is still present in the latest version, it's just that test target no longer relinks the exes, only test exes. > Then try to find the created .a file (the -v outputs should help you > where it is, something like libHSyourlibrary.a or similar), and observe > how its contents change across different builds (you could use `cmp` to > check if the files are byte-identical or something like `diff -u <(xxd > firstbuild.a) <(xxd secondbuild.a)` to view the contents as a hex diff). I ran this: cabal clean cabal build cp ./dist/build/libHScabalTest-0.1.0.0.a build.a cabal test cp ./dist/build/libHScabalTest-0.1.0.0.a test.a cabal build cp ./dist/build/libHScabalTest-0.1.0.0.a rebuild.a cabal test cp ./dist/build/libHScabalTest-0.1.0.0.a retest.a All .a files are identical. > Then try to see if this program I wrote: > http://hackage.haskell.org/package/ar-timestamp-wiper > makes the two .a files byte-identical. Installed ar-timestamp-wiper-0.1.0 . Running e.g. ar-timestamp-wiper build.a does not change its md5. > That will probably help us find the issue and get relinking-avoidance > also on the BSDs. > > On 11/11/14 13:01, Semen Trygubenko / ????? ?????????? wrote: > > So it seems that what I've observed is FreeBSD-specific ? FreeBSD rebuild outputs have extra "Linking ..." messages in them? Let me know if I could be of further help! Thanks again, S. -- ????? ?????????? http://trygub.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 181 bytes Desc: not available URL: From semen at trygub.com Fri Jan 23 16:09:52 2015 From: semen at trygub.com (Semen Trygubenko / =?utf-8?B?0KHQtdC80LXQvSDQotGA0LjQs9GD0LHQtdC9?= =?utf-8?B?0LrQvg==?=) Date: Fri, 23 Jan 2015 16:09:52 +0000 Subject: [Haskell-cafe] Happstack: serveDirectory vs serveFile Message-ID: <20150123160952.GB20146@inanna.trygub.com> Dear all, I've ran a simple benchmark where two serve functions were side-by-side in an msum and looked like dirs "hehe" $ serveDirectory DisableBrowsing [] "/hehe" dirs "favicon.ico" $ serveFile (asContentType "image/x-icon") "favicon.ico" "hehe" directory also contained file "favicon.ico". This is happstack server version 7.3.9. I've been hammering it with ab and confirmed this puzzling result: it seems that serveFile route is approximately two orders of magnitude slower than serveDirectory route... Will be grateful for any clues as to what I'm doing wrong! Thanks, S. -- ????? ?????????? http://trygub.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 181 bytes Desc: not available URL: From hsyl20 at gmail.com Fri Jan 23 17:20:22 2015 From: hsyl20 at gmail.com (Sylvain Henry) Date: Fri, 23 Jan 2015 18:20:22 +0100 Subject: [Haskell-cafe] Unacceptable argument type in foreign declaration: Ptr () In-Reply-To: References: Message-ID: Hi, "dynamic" is used to convert a FunPtr into a native Haskell function. According to [1], the first Ptr () should be something like FunPtr (Ptr () -> Ptr GUID -> IO Int32). Then you have to cast the function pointer (methPtr in [2]) into a FunPtr with Foreign.Ptr.castPtrToFunPtr. Regards, Sylvain [1] https://hackage.haskell.org/package/base-4.7.0.2/docs/Foreign-Ptr.html#g:2 [2] Lines 1420 and 1858 in https://hackage.haskell.org/package/com-1.2.3.1/src/System/Win32/Com/Automation/TypeLib.hs 2015-01-23 8:59 GMT+01:00 Henk-Jan van Tuyl : > > L.S., > > I am trying to compile a package that hasn't been updated since 2009 and I > get a lot of messages like: > Unacceptable argument type in foreign declaration: Ptr () > When checking declaration: > foreign import stdcall safe "dynamic" prim_System_Win32_Com_ > Automation_TypeLib_setGuid > :: Ptr () -> Ptr () -> Ptr GUID -> IO Int32 > > How can I correct this? > > Regards, > Henk-Jan van Tuyl > > > -- > Folding at home > What if you could share your unused computer power to help find a cure? In > just 5 minutes you can join the world's biggest networked computer and get > us closer sooner. Watch the video. > http://folding.stanford.edu/ > > > http://Van.Tuyl.eu/ > http://members.chello.nl/hjgtuyl/tourdemonad.html > Haskell programming > -- > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From omeragacan at gmail.com Fri Jan 23 20:17:47 2015 From: omeragacan at gmail.com (=?UTF-8?Q?=C3=96mer_Sinan_A=C4=9Facan?=) Date: Fri, 23 Jan 2015 15:17:47 -0500 Subject: [Haskell-cafe] up-to-date and complete version of http://packdeps.haskellers.com/reverse ? Message-ID: Hi all, I was wondering if we have up-to-date and complete version of this http://packdeps.haskellers.com/reverse. Any ideas? From michael at snoyman.com Fri Jan 23 20:35:06 2015 From: michael at snoyman.com (Michael Snoyman) Date: Fri, 23 Jan 2015 20:35:06 +0000 Subject: [Haskell-cafe] up-to-date and complete version of http://packdeps.haskellers.com/reverse ? References: Message-ID: Do you have reason to believe that that list is not up to date and complete? On Fri, Jan 23, 2015, 12:18 PM ?mer Sinan A?acan wrote: > Hi all, > > I was wondering if we have up-to-date and complete version of this > http://packdeps.haskellers.com/reverse. Any ideas? > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeremy at n-heptane.com Fri Jan 23 22:46:09 2015 From: jeremy at n-heptane.com (Jeremy Shaw) Date: Fri, 23 Jan 2015 16:46:09 -0600 Subject: [Haskell-cafe] Happstack: serveDirectory vs serveFile In-Reply-To: <20150123160952.GB20146@inanna.trygub.com> References: <20150123160952.GB20146@inanna.trygub.com> Message-ID: Hello! Underneath the hood, they are both using the same function to actually serve the file. There are a few reasons why serveDirectory might appear to be faster. The first thing to double check is that both serveDirectory and serveFile are returning 200 OK, and not 404. You want to confirm that the file really is being transferred in both cases. Given that favicon.ico is likely a small file, the time spent processing requests could be dominated by some other seemingly insignificant factor. Since serveDirectory is listed first, it is going to have a slight advantage, because the routes are tried in order. If you switch the order and list serveFile first do you see any change in performance? Additionally, in this code you could get away with using 'dir' instead of 'dirs' since you do not have any '/' in the path. Because 'dirs' has to look for the '/', it is going to take longer to search 'favicon.ico' than 'hehe' -- which would also give a slightly advantage to the serveDirectory branch. You are correct in expecting that serveFile should be faster than serveDirectory since it is supposed to do less. But microbenchmarks like this can easily be dominated by unrelated factors. - jeremy On Fri, Jan 23, 2015 at 10:09 AM, Semen Trygubenko / ????? ?????????? < semen at trygub.com> wrote: > Dear all, > > I've ran a simple benchmark where two serve functions > were side-by-side in an msum and looked like > > dirs "hehe" $ serveDirectory DisableBrowsing [] "/hehe" > dirs "favicon.ico" $ serveFile (asContentType "image/x-icon") "favicon.ico" > > "hehe" directory also contained file "favicon.ico". > > This is happstack server version 7.3.9. > > I've been hammering it with ab and confirmed this puzzling result: > it seems that serveFile route is approximately > two orders of magnitude slower than serveDirectory route... > > Will be grateful for any clues as to what I'm doing wrong! > > Thanks, > S. > > > -- > ????? ?????????? http://trygub.com > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hjgtuyl at chello.nl Sat Jan 24 00:19:27 2015 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Sat, 24 Jan 2015 01:19:27 +0100 Subject: [Haskell-cafe] Haskell wiki In-Reply-To: References: Message-ID: On Fri, 23 Jan 2015 16:47:54 +0100, Ronald Legere wrote: > Greetings, > Does anyone know how to get an account to help contribute to the > haskell wiki? Registration has been closed for the last 3 years and there > is link to email anyone that I could find, hence this "Broadcast" > message. > There are dead links and such that I would love to help clean up. > I am glad you want to help! There used to be the following text on the login page, but somehow it got lost: ---- NOTE: New wiki account creation is currently disabled. If you need an account please email "nominolo" (at the email service from Google) or on the haskell-cafe mailing list. In the email state your preferred username for the wiki. (Use Special:Listusers to check if the username is available). A wiki admin will then create an account for you and a temporary password will then be sent to your email address. This is a temporary measure. We are looking into better solutions with a shorter account creation delay. ---- So ask '"nominolo" (at the email service from Google)'; if you don't receive an answer, I can do it for you. Regards, Henk-Jan van Tuyl -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From semen at trygub.com Sat Jan 24 01:10:38 2015 From: semen at trygub.com (Semen Trygubenko / =?utf-8?B?0KHQtdC80LXQvSDQotGA0LjQs9GD0LHQtdC9?= =?utf-8?B?0LrQvg==?=) Date: Sat, 24 Jan 2015 01:10:38 +0000 Subject: [Haskell-cafe] Happstack: serveDirectory vs serveFile In-Reply-To: References: <20150123160952.GB20146@inanna.trygub.com> Message-ID: <20150124011038.GA38567@inanna.trygub.com> Hi Jeremy, Thanks for your reply. I have not found the cause of this issue, but I know now it is not related to happstack after all. On Fri, Jan 23, 2015 at 04:46:09PM -0600, Jeremy Shaw wrote: > The first thing to double check is that both serveDirectory and serveFile > are returning 200 OK, and not 404. You want to confirm that the file really > is being transferred in both cases. Confirmed. > Since serveDirectory is listed first, it is going to have a slight > advantage, because the routes are tried in order. If you switch the order > and list serveFile first do you see any change in performance? I tried that before with no luck. > Additionally, in this code you could get away with using 'dir' instead of > 'dirs' since you do not have any '/' in the path. Because 'dirs' has to > look for the '/', it is going to take longer to search 'favicon.ico' than > 'hehe' -- which would also give a slightly advantage to the serveDirectory > branch. Previously it contained a '/', but it no longer does, so I've changed it now. Thanks for the tip! > But microbenchmarks like > this can easily be dominated by unrelated factors. Yes, sadly, I've done this benchmark from behind apache. I should have benchmarked happstack in isolation before posting, but previously the results correlated very well... After some experimentation I have found that this pathological behaviour is observed when file is small and going via apache on that route. When file size goes over 1-2kb it starts to fly but for some reason serving tiny files under 1kb is dog slow. When talking to happstack direct results are sane. Thanks for your help, and sorry for starting to dig in the wrong direction... S. -- ????? ?????????? http://trygub.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 181 bytes Desc: not available URL: From gershomb at gmail.com Sat Jan 24 02:50:13 2015 From: gershomb at gmail.com (Gershom B) Date: Fri, 23 Jan 2015 21:50:13 -0500 Subject: [Haskell-cafe] Haskell wiki In-Reply-To: References: Message-ID: I have re-enabled the message on the wiki. As the wiki wasn?t picking it up properly from system messages, I just hardcoded it in to the php for now. As a special preview, note that will the main wiki is slow, https://wiki.haskell.org/Haskell is set up in the proper data center (the one that shares the database with it) and it is now almost working and quite fast. There is still some breakage (file uploads are misplaced, etc) and we are not _quite_ ready to transition. However, it is certainly ready for testing. Any issues that are discovered can be reported in the #haskell-infrastructure irc channel on freenode, or via email to admin at haskell.org. Furthermore, if anyone considers themselves a skilled (or at least experienced) mediawiki admin and wants to jump in to help with the technical side of the wiki, taking more responsibility as things go forward, please reach out to us via either of those lines of contact. Cheers, Gershom On January 23, 2015 at 7:19:31 PM, Henk-Jan van Tuyl (hjgtuyl at chello.nl) wrote: > On Fri, 23 Jan 2015 16:47:54 +0100, Ronald Legere wrote: > > > Greetings, > > Does anyone know how to get an account to help contribute to the > > haskell wiki? Registration has been closed for the last 3 years and there > > is link to email anyone that I could find, hence this "Broadcast" > > message. > > There are dead links and such that I would love to help clean up. > > > > I am glad you want to help! There used to be the following text on the > login page, but somehow it got lost: > ---- > NOTE: New wiki account creation is currently disabled. If you need an > account please email "nominolo" (at the email service from Google) or on > the haskell-cafe mailing list. > > In the email state your preferred username for the wiki. (Use > Special:Listusers to check if the username is available). A wiki admin > will then create an account for you and a temporary password will then be > sent to your email address. > > This is a temporary measure. We are looking into better solutions with a > shorter account creation delay. > ---- > > So ask '"nominolo" (at the email service from Google)'; if you don't > receive an answer, I can do it for you. > > Regards, > Henk-Jan van Tuyl > > > -- > Folding at home > What if you could share your unused computer power to help find a cure? In > just 5 minutes you can join the world's biggest networked computer and get > us closer sooner. Watch the video. > http://folding.stanford.edu/ > > > http://Van.Tuyl.eu/ > http://members.chello.nl/hjgtuyl/tourdemonad.html > Haskell programming > -- > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From k-bx at k-bx.com Sat Jan 24 09:11:09 2015 From: k-bx at k-bx.com (Konstantine Rybnikov) Date: Sat, 24 Jan 2015 11:11:09 +0200 Subject: [Haskell-cafe] up-to-date and complete version of http://packdeps.haskellers.com/reverse ? In-Reply-To: References: Message-ID: I see: > Database last updated: *2015-01-24 08:24:14.104533 UTC* So I'd say it's quite up to date. On Fri, Jan 23, 2015 at 10:17 PM, ?mer Sinan A?acan wrote: > Hi all, > > I was wondering if we have up-to-date and complete version of this > http://packdeps.haskellers.com/reverse. Any ideas? > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gautier.difolco at gmail.com Sat Jan 24 18:46:52 2015 From: gautier.difolco at gmail.com (Gautier DI FOLCO) Date: Sat, 24 Jan 2015 19:46:52 +0100 Subject: [Haskell-cafe] Monad layering and DSL Message-ID: Hello all, I'm trying to make an IMAP DSL and I'm face to an annoying issue (all the examples after are selected pieces of this: https://github.com/blackheaven/smoothmail). Here we are, IMAP provide a way to statefully interact with a server. For example: select "A" -- Select folder 'A' searchAll -- Get the list of UID (message identifiers) [1, 2, 3] But select "B" searchAll -- Get [4, 5] I decided to use the Free Monad because it seems well suite for what I'm doing and I end-up with something like that: data ImapF next = Select DirectoryName (Maybe DirectoryDescription -> next) | Noop (DirectoryDescription -> next) | Search MailSearch (Maybe [UID] -> next) -- Functor instance type Imap = Free ImapF searchAll :: Imap (Maybe [UID]) searchAll = liftF $ Search undefined id select :: DirectoryName -> Imap (Maybe DirectoryDescription) select directory = liftF $ Select directory id My main problem is the following: if I do a select of an unknown directory, I should stop the computation. My first thought was Monad Transformers. So here are the types: newtype FreeT f m a = FreeT { runFreeT :: m (FreeF f a (FreeT f m a)) } Such that f is a functor and m a monad. If I do a type Imap = FreeT ImapF Maybe I'll end up with some Maybe (ImapF a) which not expresses that the evaluation can fails but that the expression construction can fails. Then I thought harder and ends up with that: type Imap = FreeT Maybe (Free ImapF) Ok, that seems better, but all the available operations can't fail. I also have had a look at extensible effects and I think I'm stuck with the same issue of my first attempt. My goal is to provide flexibility for those who want to continue the evaluation, but to provide an API with less boilerplate in the default case. If you have any ideas/hints/comments, I'll be happy to read them. If you have any questions, I'll do my best to answer them and to make disappear all doubt and ambiguity. Thanks in advance for your help. Regards. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nominolo at googlemail.com Sun Jan 25 02:00:40 2015 From: nominolo at googlemail.com (Thomas Schilling) Date: Sun, 25 Jan 2015 03:00:40 +0100 Subject: [Haskell-cafe] Haskell wiki In-Reply-To: References: Message-ID: BTW, I would really like to remove the bottleneck / single point of failure for account creation. I asked on the infrastructure mailing list if we could setup a ticketing system (or wiki admin mailing list or something) and have a signup requests be handled by a number of wiki admins. I didn't really get a response that time. Would be really nice if we could get something better set up. On 24 January 2015 at 03:50, Gershom B wrote: > I have re-enabled the message on the wiki. As the wiki wasn?t picking it up properly from system messages, I just hardcoded it in to the php for now. > > As a special preview, note that will the main wiki is slow, https://wiki.haskell.org/Haskell is set up in the proper data center (the one that shares the database with it) and it is now almost working and quite fast. There is still some breakage (file uploads are misplaced, etc) and we are not _quite_ ready to transition. However, it is certainly ready for testing. Any issues that are discovered can be reported in the #haskell-infrastructure irc channel on freenode, or via email to admin at haskell.org. > > Furthermore, if anyone considers themselves a skilled (or at least experienced) mediawiki admin and wants to jump in to help with the technical side of the wiki, taking more responsibility as things go forward, please reach out to us via either of those lines of contact. > > Cheers, > Gershom > > > On January 23, 2015 at 7:19:31 PM, Henk-Jan van Tuyl (hjgtuyl at chello.nl) wrote: >> On Fri, 23 Jan 2015 16:47:54 +0100, Ronald Legere wrote: >> >> > Greetings, >> > Does anyone know how to get an account to help contribute to the >> > haskell wiki? Registration has been closed for the last 3 years and there >> > is link to email anyone that I could find, hence this "Broadcast" >> > message. >> > There are dead links and such that I would love to help clean up. >> > >> >> I am glad you want to help! There used to be the following text on the >> login page, but somehow it got lost: >> ---- >> NOTE: New wiki account creation is currently disabled. If you need an >> account please email "nominolo" (at the email service from Google) or on >> the haskell-cafe mailing list. >> >> In the email state your preferred username for the wiki. (Use >> Special:Listusers to check if the username is available). A wiki admin >> will then create an account for you and a temporary password will then be >> sent to your email address. >> >> This is a temporary measure. We are looking into better solutions with a >> shorter account creation delay. >> ---- >> >> So ask '"nominolo" (at the email service from Google)'; if you don't >> receive an answer, I can do it for you. >> >> Regards, >> Henk-Jan van Tuyl >> >> >> -- >> Folding at home >> What if you could share your unused computer power to help find a cure? In >> just 5 minutes you can join the world's biggest networked computer and get >> us closer sooner. Watch the video. >> http://folding.stanford.edu/ >> >> >> http://Van.Tuyl.eu/ >> http://members.chello.nl/hjgtuyl/tourdemonad.html >> Haskell programming >> -- >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Sun Jan 25 08:37:38 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Sun, 25 Jan 2015 08:37:38 +0000 Subject: [Haskell-cafe] Monad layering and DSL In-Reply-To: References: Message-ID: <20150125083738.GB2974@weber> On Sat, Jan 24, 2015 at 07:46:52PM +0100, Gautier DI FOLCO wrote: > data ImapF next = > Select DirectoryName (Maybe DirectoryDescription -> next) > | Noop (DirectoryDescription -> next) > | Search MailSearch (Maybe [UID] -> next) > -- Functor instance > type Imap = Free ImapF > > searchAll :: Imap (Maybe [UID]) > searchAll = liftF $ Search undefined id > select :: DirectoryName -> Imap (Maybe DirectoryDescription) > select directory = liftF $ Select directory id > > My main problem is the following: if I do a select of an unknown directory, > I should stop the computation. What do you mean you "should stop the computation"? Do you mean the interpretation of the free monad should be forced to stop? If so, doesn't making the type of the `Select` constructor Select DirectoryName (DirectoryDescription -> next) achieve this? That way if the interpreter talks issues a select command to the server and fails to receive a `DirectoryDescription` in return then it is forced to stop. Tom From gautier.difolco at gmail.com Sun Jan 25 21:39:48 2015 From: gautier.difolco at gmail.com (Gautier DI FOLCO) Date: Sun, 25 Jan 2015 22:39:48 +0100 Subject: [Haskell-cafe] Monad layering and DSL In-Reply-To: <20150125083738.GB2974@weber> References: <20150125083738.GB2974@weber> Message-ID: 2015-01-25 9:37 GMT+01:00 Tom Ellis < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk>: > On Sat, Jan 24, 2015 at 07:46:52PM +0100, Gautier DI FOLCO wrote: > > data ImapF next = > > Select DirectoryName (Maybe DirectoryDescription -> next) > > | Noop (DirectoryDescription -> next) > > | Search MailSearch (Maybe [UID] -> next) > > -- Functor instance > > type Imap = Free ImapF > > > > searchAll :: Imap (Maybe [UID]) > > searchAll = liftF $ Search undefined id > > select :: DirectoryName -> Imap (Maybe DirectoryDescription) > > select directory = liftF $ Select directory id > > > > My main problem is the following: if I do a select of an unknown > directory, > > I should stop the computation. > > What do you mean you "should stop the computation"? Do you mean the > interpretation of the free monad should be forced to stop? If so, doesn't > making the type of the `Select` constructor > > Select DirectoryName (DirectoryDescription -> next) > > achieve this? That way if the interpreter talks issues a select command to > the server and fails to receive a `DirectoryDescription` in return then it > is forced to stop. > > Tom > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > Hello, Thanks for your answer. If I do it this way, the evaluation is forced to be stopped, I have no way to react to this error. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Sun Jan 25 21:47:59 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Sun, 25 Jan 2015 21:47:59 +0000 Subject: [Haskell-cafe] Monad layering and DSL In-Reply-To: References: <20150125083738.GB2974@weber> Message-ID: <20150125214759.GG2974@weber> On Sun, Jan 25, 2015 at 10:39:48PM +0100, Gautier DI FOLCO wrote: > 2015-01-25 9:37 GMT+01:00 Tom Ellis < > tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk>: > > > On Sat, Jan 24, 2015 at 07:46:52PM +0100, Gautier DI FOLCO wrote: > > > data ImapF next = > > > Select DirectoryName (Maybe DirectoryDescription -> next) > > > | Noop (DirectoryDescription -> next) > > > | Search MailSearch (Maybe [UID] -> next) > > > -- Functor instance > > > type Imap = Free ImapF > > > > > > searchAll :: Imap (Maybe [UID]) > > > searchAll = liftF $ Search undefined id > > > select :: DirectoryName -> Imap (Maybe DirectoryDescription) > > > select directory = liftF $ Select directory id > > > > > > My main problem is the following: if I do a select of an unknown > > directory, > > > I should stop the computation. > > > > What do you mean you "should stop the computation"? Do you mean the > > interpretation of the free monad should be forced to stop? If so, doesn't > > making the type of the `Select` constructor > > > > Select DirectoryName (DirectoryDescription -> next) > > > > achieve this? That way if the interpreter talks issues a select command to > > the server and fails to receive a `DirectoryDescription` in return then it > > is forced to stop. > > If I do it this way, the evaluation is forced to be stopped, I have no way > to react to this error. Could you explain more precisely what you are trying to achieve, perhaps with an example? Tom From gautier.difolco at gmail.com Sun Jan 25 22:29:27 2015 From: gautier.difolco at gmail.com (Gautier DI FOLCO) Date: Sun, 25 Jan 2015 23:29:27 +0100 Subject: [Haskell-cafe] Monad layering and DSL In-Reply-To: <20150125214759.GG2974@weber> References: <20150125083738.GB2974@weber> <20150125214759.GG2974@weber> Message-ID: 2015-01-25 22:47 GMT+01:00 Tom Ellis < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk>: > On Sun, Jan 25, 2015 at 10:39:48PM +0100, Gautier DI FOLCO wrote: > > 2015-01-25 9:37 GMT+01:00 Tom Ellis < > > tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk>: > > > > > On Sat, Jan 24, 2015 at 07:46:52PM +0100, Gautier DI FOLCO wrote: > > > > data ImapF next = > > > > Select DirectoryName (Maybe DirectoryDescription -> next) > > > > | Noop (DirectoryDescription -> next) > > > > | Search MailSearch (Maybe [UID] -> next) > > > > -- Functor instance > > > > type Imap = Free ImapF > > > > > > > > searchAll :: Imap (Maybe [UID]) > > > > searchAll = liftF $ Search undefined id > > > > select :: DirectoryName -> Imap (Maybe DirectoryDescription) > > > > select directory = liftF $ Select directory id > > > > > > > > My main problem is the following: if I do a select of an unknown > > > directory, > > > > I should stop the computation. > > > > > > What do you mean you "should stop the computation"? Do you mean the > > > interpretation of the free monad should be forced to stop? If so, > doesn't > > > making the type of the `Select` constructor > > > > > > Select DirectoryName (DirectoryDescription -> next) > > > > > > achieve this? That way if the interpreter talks issues a select > command to > > > the server and fails to receive a `DirectoryDescription` in return > then it > > > is forced to stop. > > > > If I do it this way, the evaluation is forced to be stopped, I have no > way > > to react to this error. > > Could you explain more precisely what you are trying to achieve, perhaps > with an example? > > Tom > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > In fact I'm looking for a practical way to alter Imap to change it temporarily or not, globally or locally in a failable monad. Example: select "Unknown" -- will fail doSomethingUnrelated failableLessMode select "Unknown" -- will fail doSomethingUnrelated -- unreached expression -- or select "Unknown" $ do-- will fail doSomethingUnrelated -- unreached expression where :: Imap (Maybe a) -> (a -> Imap b) -> Imap (Maybe b) Is it clearer? Please let me know. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Sun Jan 25 23:12:17 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Sun, 25 Jan 2015 23:12:17 +0000 Subject: [Haskell-cafe] Monad layering and DSL In-Reply-To: References: <20150125083738.GB2974@weber> <20150125214759.GG2974@weber> Message-ID: <20150125231217.GH2974@weber> On Sun, Jan 25, 2015 at 11:29:27PM +0100, Gautier DI FOLCO wrote: > 2015-01-25 22:47 GMT+01:00 Tom Ellis < > tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk>: > > On Sun, Jan 25, 2015 at 10:39:48PM +0100, Gautier DI FOLCO wrote: > > > 2015-01-25 9:37 GMT+01:00 Tom Ellis < > > > tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk>: > > > > On Sat, Jan 24, 2015 at 07:46:52PM +0100, Gautier DI FOLCO wrote: > > > > > data ImapF next = > > > > > Select DirectoryName (Maybe DirectoryDescription -> next) > > > > > | Noop (DirectoryDescription -> next) > > > > > | Search MailSearch (Maybe [UID] -> next) > > > > > -- Functor instance > > > > > type Imap = Free ImapF > > > > > > > > > > searchAll :: Imap (Maybe [UID]) > > > > > searchAll = liftF $ Search undefined id > > > > > select :: DirectoryName -> Imap (Maybe DirectoryDescription) > > > > > select directory = liftF $ Select directory id > > > > > > > > > > My main problem is the following: if I do a select of an unknown > > > > > directory, I should stop the computation. > > > > > > > > What do you mean you "should stop the computation"? Do you mean the > > > > interpretation of the free monad should be forced to stop? If so, > > > > doesn't making the type of the `Select` constructor > > > > > > > > Select DirectoryName (DirectoryDescription -> next) > > > > > > > > achieve this? That way if the interpreter talks issues a select > > > > command to the server and fails to receive a `DirectoryDescription` > > > > in return then it is forced to stop. > > > > > > If I do it this way, the evaluation is forced to be stopped, I have no > > > way to react to this error. > > > > Could you explain more precisely what you are trying to achieve, perhaps > > with an example? > > In fact I'm looking for a practical way to alter Imap to change it > temporarily or not, globally or locally in a failable monad. > > Example: > > select "Unknown" -- will fail > doSomethingUnrelated > > failableLessMode > select "Unknown" -- will fail > doSomethingUnrelated -- unreached expression > -- or > select "Unknown" $ do-- will fail > doSomethingUnrelated -- unreached expression > > where :: Imap (Maybe a) -> (a -> Imap b) -> Imap (Maybe b) It's still not completely clear. A you looking for an implementation of ? That is essentially just MaybeT and exists for any monad: () :: (Functor m, Monad m) => m (Maybe a) -> (a -> m b) -> m (Maybe b) m f = m >>= (\x -> case x of Nothing -> return Nothing Just a -> fmap Just (f a)) From rasfar at gmail.com Sun Jan 25 23:40:03 2015 From: rasfar at gmail.com (Andrew Seniuk) Date: Sun, 25 Jan 2015 17:40:03 -0600 Subject: [Haskell-cafe] ANN: deepseq-bounded 0.5 -> 0.6 Message-ID: This may affect depending code. Please consult the distro changelog for specific information about how your code might be affected, or better yet, refer to http://www.fremissant.net/deepseq-bounded/transition-5-6-7.html and http://www.fremissant.net/deepseq-bounded/grammar.html This is a transitional version of deepseq-bounded, with stability of the grammar expected in early March for version 0.7. This also causes major version bumps to the seqaid and leaky packages. To update everything, issue cabal update cabal install --reinstall --force-reinstalls seqaid which reinstalls the latest deepseq-bounded in passing. And also if you were to run "seqaid demo" it will use the updated version of leaky, so everything's up to date. The homepage for these projects starts at http://www.fremissant.net/deepseq-bounded-seqaid-leaky.html Kind Regards, Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Mon Jan 26 03:07:43 2015 From: david.feuer at gmail.com (David Feuer) Date: Sun, 25 Jan 2015 22:07:43 -0500 Subject: [Haskell-cafe] NumberSieves status/maintenance Message-ID: This package was last updated in 2012, and the linked darcs repository is inaccessible. Do you intend to continue to maintain this package? If not, I would be happy to take over. Thanks, David Feuer From richard.lewis at gold.ac.uk Mon Jan 26 15:45:08 2015 From: richard.lewis at gold.ac.uk (Richard Lewis) Date: Mon, 26 Jan 2015 15:45:08 +0000 Subject: [Haskell-cafe] Wrapping a C++ library Message-ID: <85y4opfsvv.wl-richard.lewis@gold.ac.uk> Hi there, There is a C++ library for which I'm working on an FFI wrapper. I've written a translation unit which defines several functions with an extern "C" API. Each of the functions does a little bit of C++ to operate the third party library, but the point is that I now have a C API that I can wrap with the FFI. The next thing I did was to try and get Cabal to compile this translation unit for me. I eventually hacked together a Setup.hs that I barely understand that calls gcc to compile the .cpp file and then calls `ar` to, um, well do whatever it is that ar does with .o files, make some sort of archive, or something. Next, I need to get my hsc file (in which I define some imported functions and some data types with Storable instances for shovelling data through the FFI) to compile. This file uses the hsc2hs #include macro to include the .h file of my translation unit. In turn, that .h includes some of the C++ header files from the third party, and eventually an STL header: vector. At this point, the compiler, gcc, complains that it can't find vector. The gcc command that hsc2hs (I think?) is creating does not include -lstdc++, and nethier does it use g++, either of which would, I think, result in a successful compilation of the hsc2hs .c file. In my cabal file I have: extra-libraries: stdc++ ghc-options: -pgml g++ -Wall But these don't seem to fix anything. Perhaps they don't have any effect on how hsc2hs operates? There's a specific question here which goes something like: how do I get hsc2hs to compile code that uses STL headers? But there's also a more general question as to whether my whole approach of creating an extern "C" wrapper is actually going to work? Any answers would be very appreciated. Richard From donn at avvanta.com Mon Jan 26 16:29:24 2015 From: donn at avvanta.com (Donn Cave) Date: Mon, 26 Jan 2015 08:29:24 -0800 (PST) Subject: [Haskell-cafe] Wrapping a C++ library In-Reply-To: <85y4opfsvv.wl-richard.lewis@gold.ac.uk> References: <85y4opfsvv.wl-richard.lewis@gold.ac.uk> Message-ID: <20150126162924.CE95D93C80@mail.avvanta.com> Quoth Richard Lewis , ... > There's a specific question here which goes something like: how do I > get hsc2hs to compile code that uses STL headers? For me, that would be the first thing to fix. Use #ifdef __cplusplus, or just reorganize, so the hsc2hs-generated files are just C. You wrote your wrapper library for the C++ part, and if the callers need to be C++ it kind of defeats the purpose. >From there, I would have guessed "extra-libraries: stdc++" would do it, (assuming you have also arranged to get your wrapper library in there), but I'm no cabal expert. I use C++ more or less like you're doing, so there's hope, but I haven't gotten around to the cabal part of the exercise. Donn From amindfv at gmail.com Mon Jan 26 20:56:41 2015 From: amindfv at gmail.com (Tom Murphy) Date: Mon, 26 Jan 2015 15:56:41 -0500 Subject: [Haskell-cafe] Skolems! Message-ID: Like any good mystery, let's start with the body: repro.hs:22:5: Couldn't match type `y0' with `y' because type variable `y' would escape its scope This (rigid, skolem) type variable is bound by a type expected by the context: Foo x y -> Bool The following variables have types that mention y0 b :: Foo x0 y0 -> Bool (bound at repro.hs:18:9) Expected type: Foo x y -> Bool Actual type: Foo x0 y0 -> Bool In the first argument of `h', namely `b' In a stmt of a 'do' block: h b In the expression: do { xs <- return ["test"] :: IO [String]; let a = ... b = ...; h b } Failed, modules loaded: none. So it's the "(rigid, skolem)" error you sometimes happen across. The code that's causing it, though, is pretty unsuspicious: {-# LANGUAGE RankNTypes #-} -- remove this pragma and it typechecks (1): {-# LANGUAGE GADTs #-} data Foo x y = Foo x y main :: IO () main = do xs <- return ["test"] :: IO [String] let -- typechecks (2): -- a = Just "test" :: Maybe String -- typechecks (3): -- a = f ["test"] a = f xs :: Maybe String b = g (a :: Maybe String) :: forall x y. Foo x y -> Bool -- typechecks if it's inlined (4): -- h (g (a :: Maybe String) :: forall x y. Foo x y -> Bool) h b f :: [a] -> Maybe a f _ = Nothing -- doesnt affect typechecking: -- g :: Maybe String -> (Foo x y -> Bool) g :: Maybe String -> (forall x y. Foo x y -> Bool) g (Just _) _ = False g Nothing _ = True -- typechecks (5): -- h :: (Foo x y -> Bool) -> IO () h :: (forall x y. Foo x y -> Bool) -> IO () h = undefined This has been reproduced in ghc 7.6.3, 7.8.3, 7.8.4, and 7.10.1 RC1 Any idea what's going on? Thanks! Tom -------------- next part -------------- An HTML attachment was scrubbed... URL: From nrujac at gmail.com Mon Jan 26 21:27:32 2015 From: nrujac at gmail.com (Arjun Comar) Date: Mon, 26 Jan 2015 16:27:32 -0500 Subject: [Haskell-cafe] Wrapping a C++ library In-Reply-To: <20150126162924.CE95D93C80@mail.avvanta.com> References: <85y4opfsvv.wl-richard.lewis@gold.ac.uk> <20150126162924.CE95D93C80@mail.avvanta.com> Message-ID: Richard, If you create a straight C header that's able to call into the C++ library then what you're trying to do will work. This is the standard (though frustrating) approach to using C++ libraries within Haskell. I can send you an example cabal file for building the Haskell code against the C headers and archives if you'd like. There isn't much more to it than what you're already doing though. The key is that the headers have to be pure C and you have to force cabal to build the C code with g++ (since the implementing .c files will necessarily make C++ calls). Thanks, Arjun On Mon, Jan 26, 2015 at 11:29 AM, Donn Cave wrote: > Quoth Richard Lewis , > ... > > There's a specific question here which goes something like: how do I > > get hsc2hs to compile code that uses STL headers? > > For me, that would be the first thing to fix. Use #ifdef __cplusplus, > or just reorganize, so the hsc2hs-generated files are just C. > You wrote your wrapper library for the C++ part, and if the callers > need to be C++ it kind of defeats the purpose. > > From there, I would have guessed "extra-libraries: stdc++" would do it, > (assuming you have also arranged to get your wrapper library in there), > but I'm no cabal expert. I use C++ more or less like you're doing, so > there's hope, but I haven't gotten around to the cabal part of the > exercise. > > Donn > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bertram.felgenhauer at googlemail.com Mon Jan 26 21:54:56 2015 From: bertram.felgenhauer at googlemail.com (Bertram Felgenhauer) Date: Mon, 26 Jan 2015 22:54:56 +0100 Subject: [Haskell-cafe] Skolems! In-Reply-To: References: Message-ID: <20150126215456.GA27256@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Tom Murphy wrote: > So it's the "(rigid, skolem)" error you sometimes happen across. The code > that's causing it, though, is pretty unsuspicious: Just two clues, pointing towards `b` being monomorphic as one ontributing factor: * adding {-# LANGUAGE NoMonoLocalBinds #-} works. * giving `b` a standalone type signature makes it work, that is: let b :: forall x y. Foo x y -> Bool b = g (a :: Maybe String) I'm not sure how enabling GADTs affects type-checking here. Cheers, Bertram From donn at avvanta.com Mon Jan 26 22:37:03 2015 From: donn at avvanta.com (Donn Cave) Date: Mon, 26 Jan 2015 14:37:03 -0800 (PST) Subject: [Haskell-cafe] Wrapping a C++ library In-Reply-To: References: <85y4opfsvv.wl-richard.lewis@gold.ac.uk> <20150126162924.CE95D93C80@mail.avvanta.com> Message-ID: <20150126223703.8E086F3935@mail.avvanta.com> Quoth Arjun Comar , > Richard, > If you create a straight C header that's able to call into the C++ library > then what you're trying to do will work. This is the standard (though > frustrating) approach to using C++ libraries within Haskell. I can send you > an example cabal file for building the Haskell code against the C headers > and archives if you'd like. There isn't much more to it than what you're > already doing though. The key is that the headers have to be pure C and you > have to force cabal to build the C code with g++ (since the implementing .c > files will necessarily make C++ calls). This is probably an absurdly elementary question, but at this last point, "... force cabal to build the C code with g++ ...", wouldn't this happen automatically, since they'll really be .C, not .c, files? E.g., in Blegger.hsc (#include "blegger.h") Blegger_stub.c (C code created by hsc2hs) blegger.h (C include file) blegger.C (extern "C" { #include "blegger.h" }) ... _stub.c shouldn't need g++, and .C should get it naturally? Donn From nrujac at gmail.com Mon Jan 26 22:46:32 2015 From: nrujac at gmail.com (Arjun Comar) Date: Mon, 26 Jan 2015 17:46:32 -0500 Subject: [Haskell-cafe] Wrapping a C++ library In-Reply-To: <20150126223703.8E086F3935@mail.avvanta.com> References: <85y4opfsvv.wl-richard.lewis@gold.ac.uk> <20150126162924.CE95D93C80@mail.avvanta.com> <20150126223703.8E086F3935@mail.avvanta.com> Message-ID: Unfortunately, Cabal doesn't support C++ sources directly. So if you plan to use make or something to build the .C files outside of cabal, you're right. But if you plan to throw the .C files into the cabal file, you'll run into an issue with cabal calling gcc instead of g++ on the C++ sources. gcc might do the right thing for you, but my experience is that the result is thorny. The approach I've managed to get working is to have cabal call g++ in place of gcc, which works for both C and C++ sources. Thanks, Arjun On Mon, Jan 26, 2015 at 5:37 PM, Donn Cave wrote: > Quoth Arjun Comar , > > Richard, > > If you create a straight C header that's able to call into the C++ > library > > then what you're trying to do will work. This is the standard (though > > frustrating) approach to using C++ libraries within Haskell. I can send > you > > an example cabal file for building the Haskell code against the C headers > > and archives if you'd like. There isn't much more to it than what you're > > already doing though. The key is that the headers have to be pure C and > you > > have to force cabal to build the C code with g++ (since the implementing > .c > > files will necessarily make C++ calls). > > This is probably an absurdly elementary question, but at this last point, > "... force cabal to build the C code with g++ ...", wouldn't this happen > automatically, since they'll really be .C, not .c, files? > > E.g., in > > Blegger.hsc (#include "blegger.h") > Blegger_stub.c (C code created by hsc2hs) > blegger.h (C include file) > blegger.C (extern "C" { #include "blegger.h" }) > > ... _stub.c shouldn't need g++, and .C should get it naturally? > > Donn > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From trebla at vex.net Mon Jan 26 22:47:08 2015 From: trebla at vex.net (Albert Y. C. Lai) Date: Mon, 26 Jan 2015 17:47:08 -0500 Subject: [Haskell-cafe] Tooling for equational reasoning in Haskell In-Reply-To: References: Message-ID: <54C6C3EC.9060409@vex.net> On 2015-01-18 06:46 PM, Christopher Done wrote: > I quite enjoy doing equational reasoning to prove that my functions > satisfy some laws, I like to type out each substitution step until I > get back what I started with. The only trouble is that it's rather > manual and possibly error prone. > > Is there any tooling anywhere out there that can take in a Haskell > expression and reduce it by one step? I suggest my friend Lev Naiman's proof assistant project "Netty" https://bitbucket.org/naiman/nettyproject/overview It is not specific to Haskell. It is a general-purpose calculational proof assistant. If you want to take a look at a paper, it's somewhere on his home page: http://www.cs.utoronto.ca/~naiman/ From rasen.dubi at gmail.com Mon Jan 26 22:49:39 2015 From: rasen.dubi at gmail.com (Alexey Shmalko) Date: Tue, 27 Jan 2015 00:49:39 +0200 Subject: [Haskell-cafe] Wrapping a C++ library In-Reply-To: References: <85y4opfsvv.wl-richard.lewis@gold.ac.uk> <20150126162924.CE95D93C80@mail.avvanta.com> Message-ID: Arjun, I'm not an expert in writing Haskell binding but pretty much experienced in C/low-level stuff. You shouldn't force compilation of .c files with g++. Instead, you should keep your wrapping functions as extern "C" and place their implementation in .cpp file (which of course should be compiled with g++). Don't forget to link to C++ runtime library (-lstdc++). There is also a wiki page[1] that describes how to call C++ from Haskell. Best regards, Alexey [1]: https://wiki.haskell.org/CPlusPlusFromHaskell 2015-01-26 23:27 GMT+02:00 Arjun Comar : > Richard, > If you create a straight C header that's able to call into the C++ library > then what you're trying to do will work. This is the standard (though > frustrating) approach to using C++ libraries within Haskell. I can send you > an example cabal file for building the Haskell code against the C headers > and archives if you'd like. There isn't much more to it than what you're > already doing though. The key is that the headers have to be pure C and you > have to force cabal to build the C code with g++ (since the implementing .c > files will necessarily make C++ calls). > > Thanks, > Arjun > > On Mon, Jan 26, 2015 at 11:29 AM, Donn Cave wrote: > >> Quoth Richard Lewis , >> ... >> > There's a specific question here which goes something like: how do I >> > get hsc2hs to compile code that uses STL headers? >> >> For me, that would be the first thing to fix. Use #ifdef __cplusplus, >> or just reorganize, so the hsc2hs-generated files are just C. >> You wrote your wrapper library for the C++ part, and if the callers >> need to be C++ it kind of defeats the purpose. >> >> From there, I would have guessed "extra-libraries: stdc++" would do it, >> (assuming you have also arranged to get your wrapper library in there), >> but I'm no cabal expert. I use C++ more or less like you're doing, so >> there's hope, but I haven't gotten around to the cabal part of the >> exercise. >> >> Donn >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nrujac at gmail.com Mon Jan 26 22:55:02 2015 From: nrujac at gmail.com (Arjun Comar) Date: Mon, 26 Jan 2015 17:55:02 -0500 Subject: [Haskell-cafe] Wrapping a C++ library In-Reply-To: References: <85y4opfsvv.wl-richard.lewis@gold.ac.uk> <20150126162924.CE95D93C80@mail.avvanta.com> Message-ID: Alexey, It's unfortunately been about a year since I've worked on the project that needed FFI support so I don't recall the precise issue any longer. From talking to people in #haskell, I discovered that it would be necessary to call g++ and not gcc because gcc is unable to locate some headers and libraries that inevitably get included by C++ projects. Thanks, Arjun On Mon, Jan 26, 2015 at 5:49 PM, Alexey Shmalko wrote: > Arjun, > > I'm not an expert in writing Haskell binding but pretty much experienced > in C/low-level stuff. > > You shouldn't force compilation of .c files with g++. Instead, you should > keep your wrapping functions as extern "C" and place their implementation > in .cpp file (which of course should be compiled with g++). Don't forget to > link to C++ runtime library (-lstdc++). > > There is also a wiki page[1] that describes how to call C++ from Haskell. > > Best regards, > Alexey > > [1]: https://wiki.haskell.org/CPlusPlusFromHaskell > > 2015-01-26 23:27 GMT+02:00 Arjun Comar : > >> Richard, >> If you create a straight C header that's able to call into the C++ >> library then what you're trying to do will work. This is the standard >> (though frustrating) approach to using C++ libraries within Haskell. I can >> send you an example cabal file for building the Haskell code against the C >> headers and archives if you'd like. There isn't much more to it than what >> you're already doing though. The key is that the headers have to be pure C >> and you have to force cabal to build the C code with g++ (since the >> implementing .c files will necessarily make C++ calls). >> >> Thanks, >> Arjun >> >> On Mon, Jan 26, 2015 at 11:29 AM, Donn Cave wrote: >> >>> Quoth Richard Lewis , >>> ... >>> > There's a specific question here which goes something like: how do I >>> > get hsc2hs to compile code that uses STL headers? >>> >>> For me, that would be the first thing to fix. Use #ifdef __cplusplus, >>> or just reorganize, so the hsc2hs-generated files are just C. >>> You wrote your wrapper library for the C++ part, and if the callers >>> need to be C++ it kind of defeats the purpose. >>> >>> From there, I would have guessed "extra-libraries: stdc++" would do it, >>> (assuming you have also arranged to get your wrapper library in there), >>> but I'm no cabal expert. I use C++ more or less like you're doing, so >>> there's hope, but I haven't gotten around to the cabal part of the >>> exercise. >>> >>> Donn >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Mon Jan 26 23:23:29 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Mon, 26 Jan 2015 18:23:29 -0500 Subject: [Haskell-cafe] Skolems! In-Reply-To: <20150126215456.GA27256@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> References: <20150126215456.GA27256@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Message-ID: On Mon, Jan 26, 2015 at 4:54 PM, Bertram Felgenhauer < bertram.felgenhauer at googlemail.com> wrote: > Tom Murphy wrote: > > So it's the "(rigid, skolem)" error you sometimes happen across. The code > > that's causing it, though, is pretty unsuspicious: > > Just two clues, pointing towards `b` being monomorphic as one > ontributing factor: > > * adding {-# LANGUAGE NoMonoLocalBinds #-} works. > * giving `b` a standalone type signature makes it work, that is: > (...) > I'm not sure how enabling GADTs affects type-checking here. > See https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/other-type-extensions.html#mono-local-binds In particular: "The flag -XMonoLocalBinds is implied by -XTypeFamilies and -XGADTs. You can switch it off again with -XNoMonoLocalBinds but type inference becomes less predicatable if you do so." -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From trebla at vex.net Mon Jan 26 23:35:53 2015 From: trebla at vex.net (Albert Y. C. Lai) Date: Mon, 26 Jan 2015 18:35:53 -0500 Subject: [Haskell-cafe] Could cabal-install shows dependencies as dot or some format? In-Reply-To: References: Message-ID: <54C6CF59.2060600@vex.net> On 2015-01-21 10:00 PM, Magicloud Magiclouds wrote: > I know ghc-pkg could do that. But that is for packages already > installed. I'd like cabal-install to do that when it is trying to > resolve dependencies. > > The reason is that, now I got a "Could not resolve dependencies" > error. But I could not simply figure out why based on the output of > cabal-install. "cabal install -v3 ..." produces a long output, but I know how to read it and it contains the information needed. From ian at skybluetrades.net Tue Jan 27 06:09:13 2015 From: ian at skybluetrades.net (Ian Ross) Date: Tue, 27 Jan 2015 07:09:13 +0100 Subject: [Haskell-cafe] Wrapping a C++ library In-Reply-To: References: <85y4opfsvv.wl-richard.lewis@gold.ac.uk> <20150126162924.CE95D93C80@mail.avvanta.com> Message-ID: Hi Arjun, I've been doing quite a bit of this kind of thing recently, but it took me a while to figure it out too. I've made a little example at https://github.com/ian-ross/cpp-ffi-example -- just clone the repo and follow the instructions in the README. The example has a C++ test library to build that doesn't do anything very interesting but provides some things to bind to. It uses a C wrapper around the C++ library and C2HS to write the Haskell FFI side of things (you can almost certainly use hsc2hs in the same kind of way). There's also a small test program so you see the bindings working end-to-end. I guess the most critical thing is using extern "C" and the __cplusplus compiler macro to control the visibility of C++ code to GCC -- take a look at cbits/a.h and cbits/a.cpp in the repo to see what I mean. Feel free to ask if you have any questions. Cheers, Ian. On 26 January 2015 at 23:55, Arjun Comar wrote: > Alexey, > It's unfortunately been about a year since I've worked on the project that > needed FFI support so I don't recall the precise issue any longer. From > talking to people in #haskell, I discovered that it would be necessary to > call g++ and not gcc because gcc is unable to locate some headers and > libraries that inevitably get included by C++ projects. > > Thanks, > Arjun > > On Mon, Jan 26, 2015 at 5:49 PM, Alexey Shmalko > wrote: > >> Arjun, >> >> I'm not an expert in writing Haskell binding but pretty much experienced >> in C/low-level stuff. >> >> You shouldn't force compilation of .c files with g++. Instead, you should >> keep your wrapping functions as extern "C" and place their implementation >> in .cpp file (which of course should be compiled with g++). Don't forget to >> link to C++ runtime library (-lstdc++). >> >> There is also a wiki page[1] that describes how to call C++ from Haskell. >> >> Best regards, >> Alexey >> >> [1]: https://wiki.haskell.org/CPlusPlusFromHaskell >> >> 2015-01-26 23:27 GMT+02:00 Arjun Comar : >> >>> Richard, >>> If you create a straight C header that's able to call into the C++ >>> library then what you're trying to do will work. This is the standard >>> (though frustrating) approach to using C++ libraries within Haskell. I can >>> send you an example cabal file for building the Haskell code against the C >>> headers and archives if you'd like. There isn't much more to it than what >>> you're already doing though. The key is that the headers have to be pure C >>> and you have to force cabal to build the C code with g++ (since the >>> implementing .c files will necessarily make C++ calls). >>> >>> Thanks, >>> Arjun >>> >>> On Mon, Jan 26, 2015 at 11:29 AM, Donn Cave wrote: >>> >>>> Quoth Richard Lewis , >>>> ... >>>> > There's a specific question here which goes something like: how do I >>>> > get hsc2hs to compile code that uses STL headers? >>>> >>>> For me, that would be the first thing to fix. Use #ifdef __cplusplus, >>>> or just reorganize, so the hsc2hs-generated files are just C. >>>> You wrote your wrapper library for the C++ part, and if the callers >>>> need to be C++ it kind of defeats the purpose. >>>> >>>> From there, I would have guessed "extra-libraries: stdc++" would do it, >>>> (assuming you have also arranged to get your wrapper library in there), >>>> but I'm no cabal expert. I use C++ more or less like you're doing, so >>>> there's hope, but I haven't gotten around to the cabal part of the >>>> exercise. >>>> >>>> Donn >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>>> >>> >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>> >>> >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -- Ian Ross Tel: +43(0)6804451378 ian at skybluetrades.net www.skybluetrades.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From sumit.sahrawat.apm13 at iitbhu.ac.in Tue Jan 27 07:26:44 2015 From: sumit.sahrawat.apm13 at iitbhu.ac.in (Sumit Sahrawat, Maths & Computing, IIT (BHU)) Date: Tue, 27 Jan 2015 12:56:44 +0530 Subject: [Haskell-cafe] Tooling for equational reasoning in Haskell In-Reply-To: <54C6C3EC.9060409@vex.net> References: <54C6C3EC.9060409@vex.net> Message-ID: I found https://github.com/bmillwood/stepeval, which evaluates expressions step-by-step. It might be possible to modify it for equational reasoning. On 27 January 2015 at 04:17, Albert Y. C. Lai wrote: > On 2015-01-18 06:46 PM, Christopher Done wrote: > >> I quite enjoy doing equational reasoning to prove that my functions >> satisfy some laws, I like to type out each substitution step until I get >> back what I started with. The only trouble is that it's rather manual and >> possibly error prone. >> >> Is there any tooling anywhere out there that can take in a Haskell >> expression and reduce it by one step? >> > > I suggest my friend Lev Naiman's proof assistant project "Netty" > https://bitbucket.org/naiman/nettyproject/overview > It is not specific to Haskell. It is a general-purpose calculational proof > assistant. > > If you want to take a look at a paper, it's somewhere on his home page: > http://www.cs.utoronto.ca/~naiman/ > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Regards Sumit Sahrawat -------------- next part -------------- An HTML attachment was scrubbed... URL: From s9gf4ult at gmail.com Tue Jan 27 10:01:38 2015 From: s9gf4ult at gmail.com (Alexey Uimanov) Date: Tue, 27 Jan 2015 16:01:38 +0600 Subject: [Haskell-cafe] How to force James Cook (author of dependent-map) evaluation? Message-ID: Hello people. There is a pull request https://github.com/mokus0/dependent-map/pull/2 which I need to be on hackage. I have sent a email to mokus at deepbondi.net but nothing happened. Does anyone can contact with James and tell him about my problem? -------------- next part -------------- An HTML attachment was scrubbed... URL: From polux2001 at gmail.com Tue Jan 27 10:35:21 2015 From: polux2001 at gmail.com (Paul Brauner) Date: Tue, 27 Jan 2015 10:35:21 +0000 Subject: [Haskell-cafe] Tooling for equational reasoning in Haskell References: <54C6C3EC.9060409@vex.net> Message-ID: Stepeval is what Christopher pointed to in his first email, but he said it only works on a teeny weeny subset of Haskell. On Tue Jan 27 2015 at 8:26:55 AM Sumit Sahrawat, Maths & Computing, IIT (BHU) wrote: > I found https://github.com/bmillwood/stepeval, which evaluates > expressions step-by-step. It might be possible to modify it for equational > reasoning. > > On 27 January 2015 at 04:17, Albert Y. C. Lai wrote: > >> On 2015-01-18 06:46 PM, Christopher Done wrote: >> >>> I quite enjoy doing equational reasoning to prove that my functions >>> satisfy some laws, I like to type out each substitution step until I get >>> back what I started with. The only trouble is that it's rather manual and >>> possibly error prone. >>> >>> Is there any tooling anywhere out there that can take in a Haskell >>> expression and reduce it by one step? >>> >> >> I suggest my friend Lev Naiman's proof assistant project "Netty" >> https://bitbucket.org/naiman/nettyproject/overview >> It is not specific to Haskell. It is a general-purpose calculational >> proof assistant. >> >> If you want to take a look at a paper, it's somewhere on his home page: >> http://www.cs.utoronto.ca/~naiman/ >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > > > -- > Regards > > Sumit Sahrawat > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Lennart.Augustsson at sc.com Tue Jan 27 10:52:53 2015 From: Lennart.Augustsson at sc.com (Augustsson, Lennart) Date: Tue, 27 Jan 2015 10:52:53 +0000 Subject: [Haskell-cafe] Drastic Prelude changes imminent Message-ID: <22B950C955F8AB4196E72698FBD00002B940320C@UKWPIPXMB01A.zone1.scb.net> If you didn't know that, e.g., the type of foldr is changing, check out the thread https://www.haskell.org/pipermail/libraries/2015-January/024777.html. This email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please delete all copies and notify the sender immediately. You may wish to refer to the incorporation details of Standard Chartered PLC, Standard Chartered Bank and their subsidiaries at http://www.standardchartered.com/en/incorporation-details.html Insofar as this communication contains any market commentary, the market commentary has been prepared by a sales and/or trading desk of Standard Chartered Bank or its affiliate. It is not and does not constitute research material, independent research, recommendation or financial advice. Any market commentary is for information purpose only and shall not be relied for any other purpose, and is subject to the relevant disclaimers available at http://wholesalebanking.standardchartered.com/en/utility/Pages/d-mkt.aspx. Please visit http://wholesalebanking.standardchartered.com/en/capabilities/financialmarkets/Pages/doddfrankdisclosures.aspx for important information with respect to derivative products. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Tue Jan 27 10:59:54 2015 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Tue, 27 Jan 2015 21:59:54 +1100 Subject: [Haskell-cafe] [Haskell] Drastic Prelude changes imminent In-Reply-To: <22B950C955F8AB4196E72698FBD00002B940320C@UKWPIPXMB01A.zone1.scb.net> References: <22B950C955F8AB4196E72698FBD00002B940320C@UKWPIPXMB01A.zone1.scb.net> Message-ID: On 27 January 2015 at 21:52, Augustsson, Lennart wrote: > If you didn?t know that, e.g., the type of foldr is changing, check out the > thread https://www.haskell.org/pipermail/libraries/2015-January/024777.html. This seems to refer to your previous message, with no actual thread present and no mention of what the type of foldr is changing *to* (or what all the other bridge-breaking is going to be); is there an actual list of what these changes are? > > > > > This email and any attachments are confidential and may also be privileged. > If you are not the intended recipient, please delete all copies and notify > the sender immediately. You may wish to refer to the incorporation details > of Standard Chartered PLC, Standard Chartered Bank and their subsidiaries at > http://www.standardchartered.com/en/incorporation-details.html > > Insofar as this communication contains any market commentary, the market > commentary has been prepared by a sales and/or trading desk of Standard > Chartered Bank or its affiliate. It is not and does not constitute research > material, independent research, recommendation or financial advice. Any > market commentary is for information purpose only and shall not be relied > for any other purpose, and is subject to the relevant disclaimers available > at > http://wholesalebanking.standardchartered.com/en/utility/Pages/d-mkt.aspx. > > Please visit > http://wholesalebanking.standardchartered.com/en/capabilities/financialmarkets/Pages/doddfrankdisclosures.aspx > for important information with respect to derivative products. > > _______________________________________________ > Haskell mailing list > Haskell at haskell.org > http://www.haskell.org/mailman/listinfo/haskell > -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From Lennart.Augustsson at sc.com Tue Jan 27 11:10:47 2015 From: Lennart.Augustsson at sc.com (Augustsson, Lennart) Date: Tue, 27 Jan 2015 11:10:47 +0000 Subject: [Haskell-cafe] [Haskell] Drastic Prelude changes imminent In-Reply-To: References: <22B950C955F8AB4196E72698FBD00002B940320C@UKWPIPXMB01A.zone1.scb.net> Message-ID: <22B950C955F8AB4196E72698FBD00002B9403242@UKWPIPXMB01A.zone1.scb.net> Sorry, I meant to include a link to BBP. Here it is, https://ghc.haskell.org/trac/ghc/ticket/9586 -----Original Message----- From: Ivan Lazar Miljenovic [mailto:ivan.miljenovic at gmail.com] Sent: 27 January 2015 11:00 To: Augustsson, Lennart Cc: haskell at haskell.org; haskell-cafe at haskell.org Subject: Re: [Haskell] Drastic Prelude changes imminent On 27 January 2015 at 21:52, Augustsson, Lennart wrote: > If you didn?t know that, e.g., the type of foldr is changing, check > out the thread https://www.haskell.org/pipermail/libraries/2015-January/024777.html. This seems to refer to your previous message, with no actual thread present and no mention of what the type of foldr is changing *to* (or what all the other bridge-breaking is going to be); is there an actual list of what these changes are? > > > > > This email and any attachments are confidential and may also be privileged. > If you are not the intended recipient, please delete all copies and > notify the sender immediately. You may wish to refer to the > incorporation details of Standard Chartered PLC, Standard Chartered > Bank and their subsidiaries at > http://www.standardchartered.com/en/incorporation-details.html > > Insofar as this communication contains any market commentary, the > market commentary has been prepared by a sales and/or trading desk of > Standard Chartered Bank or its affiliate. It is not and does not > constitute research material, independent research, recommendation or > financial advice. Any market commentary is for information purpose > only and shall not be relied for any other purpose, and is subject to > the relevant disclaimers available at > http://wholesalebanking.standardchartered.com/en/utility/Pages/d-mkt.aspx. > > Please visit > http://wholesalebanking.standardchartered.com/en/capabilities/financia > lmarkets/Pages/doddfrankdisclosures.aspx > for important information with respect to derivative products. > > _______________________________________________ > Haskell mailing list > Haskell at haskell.org > http://www.haskell.org/mailman/listinfo/haskell > -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com This email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please delete all copies and notify the sender immediately. You may wish to refer to the incorporation details of Standard Chartered PLC, Standard Chartered Bank and their subsidiaries at http://www.standardchartered.com/en/incorporation-details.html Insofar as this communication contains any market commentary, the market commentary has been prepared by a sales and/or trading desk of Standard Chartered Bank or its affiliate. It is not and does not constitute research material, independent research, recommendation or financial advice. Any market commentary is for information purpose only and shall not be relied for any other purpose, and is subject to the relevant disclaimers available at http://wholesalebanking.standardchartered.com/en/utility/Pages/d-mkt.aspx. Please visit http://wholesalebanking.standardchartered.com/en/capabilities/financialmarkets/Pages/doddfrankdisclosures.aspx for important information with respect to derivative products. From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Tue Jan 27 12:38:25 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Tue, 27 Jan 2015 12:38:25 +0000 Subject: [Haskell-cafe] Multi-pattern LambdaCase? Message-ID: <20150127123824.GB8436@weber> Is there a particular reason that LambdaCase does not support muliple patterns? Specifically I am suggesting that \case { pA1 pA2 pA3 -> eA, ... } be sugar for \freshName1 freshName2 freshName3 -> case freshName1 freshName2 freshName3 of { pA1 pA2 pA3 -> eA, ... } Is there some technical reason that prevents it? Tom From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Tue Jan 27 12:43:31 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Tue, 27 Jan 2015 12:43:31 +0000 Subject: [Haskell-cafe] Multi-pattern LambdaCase? In-Reply-To: <20150127123824.GB8436@weber> References: <20150127123824.GB8436@weber> Message-ID: <20150127124331.GC8436@weber> On Tue, Jan 27, 2015 at 12:38:25PM +0000, Tom Ellis wrote: > Is there a particular reason that LambdaCase does not support muliple > patterns? Specifically I am suggesting that > > \case { pA1 pA2 pA3 -> eA, ... } > > be sugar for ... Is there some technical reason that prevents it? Correction to my sugar: \freshName1 freshName2 freshName3 -> case (freshName1, freshName2, freshName3) of { (pA1, pA2, pA3) -> eA, ... } (or in practice probably an unboxed tuple) From roma at ro-che.info Tue Jan 27 13:05:05 2015 From: roma at ro-che.info (Roman Cheplyaka) Date: Tue, 27 Jan 2015 15:05:05 +0200 Subject: [Haskell-cafe] Multi-pattern LambdaCase? In-Reply-To: <20150127123824.GB8436@weber> References: <20150127123824.GB8436@weber> Message-ID: <54C78D01.2010909@ro-che.info> On 27/01/15 14:38, Tom Ellis wrote: > Is there a particular reason that LambdaCase does not support muliple > patterns? Specifically I am suggesting that > > \case { pA1 pA2 pA3 -> eA, ... } > > be sugar for > > \freshName1 freshName2 freshName3 > -> case freshName1 freshName2 freshName3 of { pA1 pA2 pA3 -> eA, ... } > > Is there some technical reason that prevents it? That'd introduce a syntactic ambiguity; pA1 pA2 pA3 is a valid pattern by itself (as in "Just True"). Roman From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Tue Jan 27 14:00:42 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Tue, 27 Jan 2015 14:00:42 +0000 Subject: [Haskell-cafe] Multi-pattern LambdaCase? In-Reply-To: <54C78D01.2010909@ro-che.info> References: <20150127123824.GB8436@weber> <54C78D01.2010909@ro-che.info> Message-ID: <20150127140041.GD8436@weber> On Tue, Jan 27, 2015 at 03:05:05PM +0200, Roman Cheplyaka wrote: > On 27/01/15 14:38, Tom Ellis wrote: > > Is there a particular reason that LambdaCase does not support muliple > > patterns? Specifically I am suggesting that > > > > \case { pA1 pA2 pA3 -> eA, ... } > > > > be sugar for > > > > \freshName1 freshName2 freshName3 > > -> case freshName1 freshName2 freshName3 of { pA1 pA2 pA3 -> eA, ... } > > > > Is there some technical reason that prevents it? > > That'd introduce a syntactic ambiguity; pA1 pA2 pA3 is a valid pattern > by itself (as in "Just True"). Ah good point indeed. I was imagining that my proposal would bring \case in line with function pattern binds, but the latter need parens around `Just True`. I still think this would be a decent idea for a different language, but not, it seems, for Haskell. Thanks for pointing it out. Tom From aranea at aixah.de Tue Jan 27 14:40:32 2015 From: aranea at aixah.de (Luis Ressel) Date: Tue, 27 Jan 2015 15:40:32 +0100 Subject: [Haskell-cafe] Drastic Prelude changes imminent In-Reply-To: <22B950C955F8AB4196E72698FBD00002B940320C@UKWPIPXMB01A.zone1.scb.net> References: <22B950C955F8AB4196E72698FBD00002B940320C@UKWPIPXMB01A.zone1.scb.net> Message-ID: <20150127154032.7944b946@gentp.lnet> Heck, a signal/noise ratio of 2 lines / 15 lines. Fix your MUA. -- Luis Ressel GPG fpr: F08D 2AF6 655E 25DE 52BC E53D 08F5 7F90 3029 B5BD From david.feuer at gmail.com Tue Jan 27 15:17:19 2015 From: david.feuer at gmail.com (David Feuer) Date: Tue, 27 Jan 2015 10:17:19 -0500 Subject: [Haskell-cafe] How to force James Cook (author of dependent-map) evaluation? In-Reply-To: References: Message-ID: Why do you need that? What does it do? Does it work with all older GHC versions? If the package is broken without it, and it doesn't break older versions, you can probably get a Hackage trustee to make the change if the maintainer does not respond. On Jan 27, 2015 5:01 AM, "Alexey Uimanov" wrote: > Hello people. There is a pull request > https://github.com/mokus0/dependent-map/pull/2 which I need to be on > hackage. I have sent a email to mokus at deepbondi.net but nothing happened. > > Does anyone can contact with James and tell him about my problem? > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From richard.lewis at gold.ac.uk Tue Jan 27 15:40:51 2015 From: richard.lewis at gold.ac.uk (Richard Lewis) Date: Tue, 27 Jan 2015 15:40:51 +0000 Subject: [Haskell-cafe] Wrapping a C++ library In-Reply-To: <20150126162924.CE95D93C80@mail.avvanta.com> References: <85y4opfsvv.wl-richard.lewis@gold.ac.uk> <20150126162924.CE95D93C80@mail.avvanta.com> Message-ID: <85386w6xks.wl-richard.lewis@gold.ac.uk> Donn, Arjun, Alexey, Ian, Thanks, all, for your suggestions. At Mon, 26 Jan 2015 08:29:24 -0800, Donn Cave wrote: > > Quoth Richard Lewis , > ... > > There's a specific question here which goes something like: how do I > > get hsc2hs to compile code that uses STL headers? > > For me, that would be the first thing to fix. Use #ifdef __cplusplus, > or just reorganize, so the hsc2hs-generated files are just C. > You wrote your wrapper library for the C++ part, and if the callers > need to be C++ it kind of defeats the purpose. Yes, so it turns out the problem was that my wrapper .h was including one of the headers of the third party library which, in turn, was including vector. But I've managed to arrange it so that I don't need to include that third party header anymore so gcc can compile my translation unit without problems. > From there, I would have guessed "extra-libraries: stdc++" would do it, > (assuming you have also arranged to get your wrapper library in there), > but I'm no cabal expert. I use C++ more or less like you're doing, so > there's hope, but I haven't gotten around to the cabal part of the > exercise. The challenge with Cabal now is to get it to link my .a library with the libHSMyLibrary.a that GHC creates. It seems, from what I've read [1], that there is no Cabal hook into the linker so it may involve quite a bit of work in the Setup.hs file. I was just following up a suggestion [2] that (I think), if the .a file Cabal has created for my wrapper static library is in the same directory as, um, not sure what--output libHSMyLibrary.a? gcc working directory?--and if its name is of the form "libxxx.a", then it may be possible to add -lmylib to gcc's options, and gcc will pick it up. Anyway, I altered my Setup.hs to do this, putting libmylib.a in dist/build and dynamically adding /path/to/dist/build to the "extra-libraries" option, but nm still reports that the resulting libHSMyLibrary.a does not contain libmylib.a (or would it be mylib.o?). This might be a discussion for a new thread, however. The immediate problem of how to compile the C wrapper is now fixed. Richard [1] http://stackoverflow.com/questions/18543228/statically-linking-a-c-library-with-a-haskell-library [2] https://www.haskell.org/pipermail/haskell-cafe/2006-June/016022.html From david.feuer at gmail.com Tue Jan 27 17:04:18 2015 From: david.feuer at gmail.com (David Feuer) Date: Tue, 27 Jan 2015 12:04:18 -0500 Subject: [Haskell-cafe] Help finding one-sided ordered list implementation Message-ID: In "Numerical Representations as Higher-Order Nested Datatypes", Ralf Hinze describes an implementation of one-sided ordered lists as 2-3 search trees under the left spine view. I'm wondering if anyone's actually coded those up somewhere I could download them, or if I'll have to dig into all the details in the paper and write them myself. Thanks, David From dct25-561bs at mythic-beasts.com Tue Jan 27 17:18:41 2015 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Tue, 27 Jan 2015 17:18:41 +0000 Subject: [Haskell-cafe] Representation of lenses Message-ID: Hi, I'm planning on discussing lenses with some colleagues shortly so I'm consolidating some of my notes into a coherent story. At one point I found myself describing lenses as a way of packaging up a getter and a setter into a single thing. However, this raises the question: why not just use a pair (getter, setter)? More precisely, I believe that the types (a -> s, s -> a -> a) and (forall f. Functor f => (s -> f s) -> a -> f a) are isomorphic. Is that right? I see that one advantage of the lens type is that you can use (.) to compose them since they're just functions, but that doesn't bother me much and it seems I could define another operator to compose (getter, setter) lenses and the rest of the machinery would work either way. It's also possible that you can't get the full generality of (forall f. (s -> f t) -> a -> f b) lenses with getter/setter pairs, although I haven't worked through the details yet so don't know either way. So, my question is: what is the advantage of representing lenses in the way that they are? Many thanks, David From ratzes at gmail.com Tue Jan 27 17:23:34 2015 From: ratzes at gmail.com (Charles Durham) Date: Tue, 27 Jan 2015 12:23:34 -0500 Subject: [Haskell-cafe] Representation of lenses In-Reply-To: References: Message-ID: You need to sign up for it, but this is a phenomenal talk by simon peyton jones describing the idea behind lenses the way he understood it. https://skillsmatter.com/skillscasts/4251-lenses-compositional-data-access-and-manipulation On Tue, Jan 27, 2015 at 12:18 PM, David Turner < dct25-561bs at mythic-beasts.com> wrote: > Hi, > > I'm planning on discussing lenses with some colleagues shortly so I'm > consolidating some of my notes into a coherent story. At one point I > found myself describing lenses as a way of packaging up a getter and a > setter into a single thing. However, this raises the question: why not > just use a pair (getter, setter)? More precisely, I believe that the > types (a -> s, s -> a -> a) and (forall f. Functor f => (s -> f s) -> > a -> f a) are isomorphic. Is that right? > > I see that one advantage of the lens type is that you can use (.) to > compose them since they're just functions, but that doesn't bother me > much and it seems I could define another operator to compose (getter, > setter) lenses and the rest of the machinery would work either way. > > It's also possible that you can't get the full generality of (forall > f. (s -> f t) -> a -> f b) lenses with getter/setter pairs, although I > haven't worked through the details yet so don't know either way. > > So, my question is: what is the advantage of representing lenses in > the way that they are? > > Many thanks, > > David > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Tue Jan 27 17:25:35 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Tue, 27 Jan 2015 17:25:35 +0000 Subject: [Haskell-cafe] Representation of lenses In-Reply-To: References: Message-ID: <20150127172534.GA10648@weber> On Tue, Jan 27, 2015 at 05:18:41PM +0000, David Turner wrote: > I believe that the types (a -> s, s -> a -> a) and (forall f. Functor f > => (s -> f s) -> a -> f a) are isomorphic. Is that right? Yes (with the caveat that I don't actually know how to prove this). > It's also possible that you can't get the full generality of (forall > f. (s -> f t) -> a -> f b) lenses with getter/setter pairs No, they are equivalent. > So, my question is: what is the advantage of representing lenses in > the way that they are? The advantage that's most obvious to me is polymorphism. You can use a lens forall f. Functor f => (s -> f s) -> a -> f a where the callee expects a traversal forall f. Applicative f => (s -> f s) -> a -> f a This is very convenient in practice. Perhaps there are other practical advantages that someone else can explain. Tom From hjgtuyl at chello.nl Tue Jan 27 17:30:59 2015 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Tue, 27 Jan 2015 18:30:59 +0100 Subject: [Haskell-cafe] Error trying to re-upload to the Haskell wiki Message-ID: L.S., I am trying to upload a file to the Haskell wiki again, after I deleted it (the description was wrong and there is no option to edit the description). Every time I try this, I get the message: Remote server or file not found You tried to access the address https://wiki.haskell.org/Special:Upload, which is currently unavailable. The file is not visible in the upload log. How can I upload this file again? Regards, Henk-Jan van Tuyl -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From dct25-561bs at mythic-beasts.com Tue Jan 27 17:50:44 2015 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Tue, 27 Jan 2015 17:50:44 +0000 Subject: [Haskell-cafe] Representation of lenses In-Reply-To: <20150127172534.GA10648@weber> References: <20150127172534.GA10648@weber> Message-ID: For the record, I think the isomorphism uses the Const s functor to recover the getter and the Identity functor to recover the setter. It's something like this: Given (get, set), the corresponding lens is \f x. fmap (flip set x) (f (get x)) Given a lens ell the getter/setter pair is (runConst . ell Const, \v -> runIdentity . ell (Identity . const v)) Notice that Const s is not an Applicative (e.g. pure :: () -> Const Void () doesn't exist) which is why (forall f. Applicative f => (s -> f s) -> a -> f a) proscribes getting your hands on the getter. On 27 January 2015 at 17:25, Tom Ellis wrote: > On Tue, Jan 27, 2015 at 05:18:41PM +0000, David Turner wrote: >> I believe that the types (a -> s, s -> a -> a) and (forall f. Functor f >> => (s -> f s) -> a -> f a) are isomorphic. Is that right? > > Yes (with the caveat that I don't actually know how to prove this). > >> It's also possible that you can't get the full generality of (forall >> f. (s -> f t) -> a -> f b) lenses with getter/setter pairs > > No, they are equivalent. > >> So, my question is: what is the advantage of representing lenses in >> the way that they are? > > The advantage that's most obvious to me is polymorphism. You can use a lens > > forall f. Functor f => (s -> f s) -> a -> f a > > where the callee expects a traversal > > forall f. Applicative f => (s -> f s) -> a -> f a > > This is very convenient in practice. Perhaps there are other practical > advantages that someone else can explain. > > Tom > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Tue Jan 27 17:53:48 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Tue, 27 Jan 2015 17:53:48 +0000 Subject: [Haskell-cafe] Representation of lenses In-Reply-To: References: <20150127172534.GA10648@weber> Message-ID: <20150127175348.GB10648@weber> On Tue, Jan 27, 2015 at 05:50:44PM +0000, David Turner wrote: > Notice that Const s is not an Applicative (e.g. pure :: () -> Const > Void () doesn't exist) which is why (forall f. Applicative f => (s -> > f s) -> a -> f a) proscribes getting your hands on the getter. Right, unless `s` is a `Monoid` in which case you can "get" out of a `Traversal` by combining all the targets :) From vogt.adam at gmail.com Tue Jan 27 18:05:59 2015 From: vogt.adam at gmail.com (adam vogt) Date: Tue, 27 Jan 2015 13:05:59 -0500 Subject: [Haskell-cafe] Drastic Prelude changes imminent In-Reply-To: References: <22B950C955F8AB4196E72698FBD00002B94031A0@UKWPIPXMB01A.zone1.scb.net> <22B950C955F8AB4196E72698FBD00002B94033F1@UKWPIPXMB01A.zone1.scb.net> Message-ID: On Tue, Jan 27, 2015 at 11:03 AM, Johan Tibell wrote: > Looking at the generalizations in Data.List I find them pretty odd now when > I think about it. I'd expect Data.List functions to be monomorphic to lists, > just like I expect functions in Data.Map to be monomorphic to maps. Now > there might be generalized versions of these functions in e.g. the Prelude, > but generalizing Data.List means that I don't even have the monomorphic > versions available if I want to resolve ambiguity by using them*. > > * It turns out resolving ambiguity is pretty annoying. The type signatures > are awkward to write so I end having to write something akin to > > mymap :: (a -> b) -> [a] -> [b] > mymap = map Unless you're using -XOverloadedLists, you can throw in a (`asTypeOf` []) to disambiguate. Or is that the annoyance you were talking about? From dct25-561bs at mythic-beasts.com Tue Jan 27 18:09:31 2015 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Tue, 27 Jan 2015 18:09:31 +0000 Subject: [Haskell-cafe] Representation of lenses In-Reply-To: References: Message-ID: Thanks, I'll give that a watch. On 27 Jan 2015 17:23, "Charles Durham" wrote: > You need to sign up for it, but this is a phenomenal talk by simon peyton > jones describing the idea behind lenses the way he understood it. > > > https://skillsmatter.com/skillscasts/4251-lenses-compositional-data-access-and-manipulation > > On Tue, Jan 27, 2015 at 12:18 PM, David Turner < > dct25-561bs at mythic-beasts.com> wrote: > >> Hi, >> >> I'm planning on discussing lenses with some colleagues shortly so I'm >> consolidating some of my notes into a coherent story. At one point I >> found myself describing lenses as a way of packaging up a getter and a >> setter into a single thing. However, this raises the question: why not >> just use a pair (getter, setter)? More precisely, I believe that the >> types (a -> s, s -> a -> a) and (forall f. Functor f => (s -> f s) -> >> a -> f a) are isomorphic. Is that right? >> >> I see that one advantage of the lens type is that you can use (.) to >> compose them since they're just functions, but that doesn't bother me >> much and it seems I could define another operator to compose (getter, >> setter) lenses and the rest of the machinery would work either way. >> >> It's also possible that you can't get the full generality of (forall >> f. (s -> f t) -> a -> f b) lenses with getter/setter pairs, although I >> haven't worked through the details yet so don't know either way. >> >> So, my question is: what is the advantage of representing lenses in >> the way that they are? >> >> Many thanks, >> >> David >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Tue Jan 27 20:08:21 2015 From: david.feuer at gmail.com (David Feuer) Date: Tue, 27 Jan 2015 15:08:21 -0500 Subject: [Haskell-cafe] Representation of lenses In-Reply-To: References: Message-ID: One significant reason is that the getter/setter pair doesn't support efficient update operations in a nested structure. Updating the hundredth element of a list would require getting it, applying a function to it, and then setting it. With the fancy type and magic tricks, you only need to dig down to the right place once. On Tue, Jan 27, 2015 at 1:09 PM, David Turner wrote: > Thanks, I'll give that a watch. > > On 27 Jan 2015 17:23, "Charles Durham" wrote: >> >> You need to sign up for it, but this is a phenomenal talk by simon peyton >> jones describing the idea behind lenses the way he understood it. >> >> >> https://skillsmatter.com/skillscasts/4251-lenses-compositional-data-access-and-manipulation >> >> On Tue, Jan 27, 2015 at 12:18 PM, David Turner >> wrote: >>> >>> Hi, >>> >>> I'm planning on discussing lenses with some colleagues shortly so I'm >>> consolidating some of my notes into a coherent story. At one point I >>> found myself describing lenses as a way of packaging up a getter and a >>> setter into a single thing. However, this raises the question: why not >>> just use a pair (getter, setter)? More precisely, I believe that the >>> types (a -> s, s -> a -> a) and (forall f. Functor f => (s -> f s) -> >>> a -> f a) are isomorphic. Is that right? >>> >>> I see that one advantage of the lens type is that you can use (.) to >>> compose them since they're just functions, but that doesn't bother me >>> much and it seems I could define another operator to compose (getter, >>> setter) lenses and the rest of the machinery would work either way. >>> >>> It's also possible that you can't get the full generality of (forall >>> f. (s -> f t) -> a -> f b) lenses with getter/setter pairs, although I >>> haven't worked through the details yet so don't know either way. >>> >>> So, my question is: what is the advantage of representing lenses in >>> the way that they are? >>> >>> Many thanks, >>> >>> David >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From dct25-561bs at mythic-beasts.com Tue Jan 27 20:29:49 2015 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Tue, 27 Jan 2015 20:29:49 +0000 Subject: [Haskell-cafe] Representation of lenses In-Reply-To: References: Message-ID: On 27 January 2015 at 17:23, Charles Durham wrote: > You need to sign up for it, but this is a phenomenal talk by simon peyton > jones describing the idea behind lenses the way he understood it. > > https://skillsmatter.com/skillscasts/4251-lenses-compositional-data-access-and-manipulation Thanks, I think that was exactly what I needed to know. If I understand the key section right, you can do all that stuff with a straight get/set pair but it'd be desperately inefficient, so then you add an update function, and then one at Maybe and [] and IO and they all start to look the same so you generalise to all Functors, and then you discover that using Const you get a getter, and Identity gives you a setter, so you can throw them away and end up with a lens as we know it. And then you generalise it in about a billion other directions and you end up with the lens library! Much obliged, David From hesselink at gmail.com Tue Jan 27 21:45:22 2015 From: hesselink at gmail.com (Erik Hesselink) Date: Tue, 27 Jan 2015 22:45:22 +0100 Subject: [Haskell-cafe] Representation of lenses In-Reply-To: References: Message-ID: On Tue, Jan 27, 2015 at 9:29 PM, David Turner wrote: > On 27 January 2015 at 17:23, Charles Durham wrote: >> You need to sign up for it, but this is a phenomenal talk by simon peyton >> jones describing the idea behind lenses the way he understood it. >> >> https://skillsmatter.com/skillscasts/4251-lenses-compositional-data-access-and-manipulation > > Thanks, I think that was exactly what I needed to know. > > If I understand the key section right, you can do all that stuff with > a straight get/set pair but it'd be desperately inefficient, so then > you add an update function, and then one at Maybe and [] and IO and > they all start to look the same so you generalise to all Functors, and > then you discover that using Const you get a getter, and Identity > gives you a setter, so you can throw them away and end up with a lens > as we know it. > > And then you generalise it in about a billion other directions and you > end up with the lens library! Just wanted to note that 'lens' is not the only lens library. There are many others (data-lens, fclabels, data-accessor, ...) and most use a getter/setter or getter/modifier combination. Erik From chrisdone at gmail.com Tue Jan 27 22:14:09 2015 From: chrisdone at gmail.com (Christopher Done) Date: Tue, 27 Jan 2015 23:14:09 +0100 Subject: [Haskell-cafe] runSubStateT Message-ID: runSubStateT :: Monad m => (s -> s') -> (s' -> s) -> StateT s' m a -> StateT s m a runSubStateT to from m = StateT (\s -> liftM (\(a,s') -> (a,from s')) (runStateT m (to s))) Anyone ever needed something like this? Does it already exist in some form in the standard libraries? Ciao From pkmx.tw at gmail.com Tue Jan 27 22:20:45 2015 From: pkmx.tw at gmail.com (PkmX) Date: Wed, 28 Jan 2015 06:20:45 +0800 Subject: [Haskell-cafe] runSubStateT In-Reply-To: References: Message-ID: Isn't this exactly what the `zoom` function does from `Control.Lens.Zoom`? > flip execState (1, 1) $ zoom _1 $ modify succ (2, 1) On Wed, Jan 28, 2015 at 6:14 AM, Christopher Done wrote: > runSubStateT :: Monad m > => (s -> s') -> (s' -> s) -> StateT s' m a -> StateT s m a > runSubStateT to from m = > StateT (\s -> > liftM (\(a,s') -> (a,from s')) > (runStateT m (to s))) > > Anyone ever needed something like this? Does it already exist in some > form in the standard libraries? > > Ciao > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -- Chih-Mao Chen (PkmX) System Software Laboratory Department of Computer Science National Chiao Tung University From wojciech.danilo at gmail.com Tue Jan 27 23:10:55 2015 From: wojciech.danilo at gmail.com (Wojciech Danilo) Date: Tue, 27 Jan 2015 23:10:55 +0000 Subject: [Haskell-cafe] Using GHC API to compile Haskell sources to CORE and CORE to binary Message-ID: Hello All! :) Recently I've came across a problem and hopefully you could help me with it. Basically I and some people here are running a startup and we have created a language for processing images. This language has 2 interchangeable representations - textual and visual, dataflow one. Right now we are compiling it to haskell sources, but we want to move over GHC CORE. Getting into GHC has a high learning curve, as far as we see, and we would be very thankfull for any help with a minimal working example of compiling haskell sources to CORE and then CORE to binaries. I've posted couple days ago a detailed question on StackOverflow, here: http://stackoverflow.com/questions/28059669/using-ghc-api-to-compile-haskell-sources-to-core-and-core-to-binary I would be very thankful for any help or hints! All the best, Wojciech -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Wed Jan 28 02:55:12 2015 From: david.feuer at gmail.com (David Feuer) Date: Tue, 27 Jan 2015 21:55:12 -0500 Subject: [Haskell-cafe] Using GHC API to compile Haskell sources to CORE and CORE to binary In-Reply-To: References: Message-ID: There used to be an external representation of core intended to be used for such things. It was recently removed because it had gotten stale and no one wanted to take responsibility for maintaining it. So at the moment, Core is really just an AST, not a proper language, and you'll have to hack GHC if you want to inject it. On Tue, Jan 27, 2015 at 6:10 PM, Wojciech Danilo wrote: > Hello All! :) > Recently I've came across a problem and hopefully you could help me with it. > Basically I and some people here are running a startup and we have created a > language for processing images. This language has 2 interchangeable > representations - textual and visual, dataflow one. > > Right now we are compiling it to haskell sources, but we want to move over > GHC CORE. Getting into GHC has a high learning curve, as far as we see, and > we would be very thankfull for any help with a minimal working example of > compiling haskell sources to CORE and then CORE to binaries. I've posted > couple days ago a detailed question on StackOverflow, here: > > http://stackoverflow.com/questions/28059669/using-ghc-api-to-compile-haskell-sources-to-core-and-core-to-binary > > > I would be very thankful for any help or hints! > All the best, > Wojciech > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From wojciech.danilo at gmail.com Wed Jan 28 03:12:09 2015 From: wojciech.danilo at gmail.com (Wojciech Danilo) Date: Wed, 28 Jan 2015 03:12:09 +0000 Subject: [Haskell-cafe] Using GHC API to compile Haskell sources to CORE and CORE to binary References: Message-ID: Hello David, thank you for your response! :) I've got few questions regarding it: 1) Does it mean there are no datatypes dedicated to "a core language" ? 2) All passes are transforming AST -> AST? If so, what does the function `compileToCoreModule` does? 3) Additional - is there any subset of the AST that we can call "CORE" ? 4) Do all the documentation (like this one: https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/CoreSynType) should be considered obsolete? All the best, Wojciech Wed Jan 28 2015 at 3:55:12 AM u?ytkownik David Feuer napisa?: > There used to be an external representation of core intended to be > used for such things. It was recently removed because it had gotten > stale and no one wanted to take responsibility for maintaining it. So > at the moment, Core is really just an AST, not a proper language, and > you'll have to hack GHC if you want to inject it. > > On Tue, Jan 27, 2015 at 6:10 PM, Wojciech Danilo > wrote: > > Hello All! :) > > Recently I've came across a problem and hopefully you could help me with > it. > > Basically I and some people here are running a startup and we have > created a > > language for processing images. This language has 2 interchangeable > > representations - textual and visual, dataflow one. > > > > Right now we are compiling it to haskell sources, but we want to move > over > > GHC CORE. Getting into GHC has a high learning curve, as far as we see, > and > > we would be very thankfull for any help with a minimal working example of > > compiling haskell sources to CORE and then CORE to binaries. I've posted > > couple days ago a detailed question on StackOverflow, here: > > > > http://stackoverflow.com/questions/28059669/using-ghc- > api-to-compile-haskell-sources-to-core-and-core-to-binary > > > > > > I would be very thankful for any help or hints! > > All the best, > > Wojciech > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Wed Jan 28 03:53:01 2015 From: david.feuer at gmail.com (David Feuer) Date: Tue, 27 Jan 2015 22:53:01 -0500 Subject: [Haskell-cafe] Using GHC API to compile Haskell sources to CORE and CORE to binary In-Reply-To: References: Message-ID: I can't answer all those questions, but I believe CoreSynType is the AST representing Core. On Tue, Jan 27, 2015 at 10:12 PM, Wojciech Danilo wrote: > Hello David, thank you for your response! :) > I've got few questions regarding it: > 1) Does it mean there are no datatypes dedicated to "a core language" ? > 2) All passes are transforming AST -> AST? If so, what does the function > `compileToCoreModule` does? > 3) Additional - is there any subset of the AST that we can call "CORE" ? > 4) Do all the documentation (like this one: > https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/CoreSynType) > should be considered obsolete? > > All the best, > Wojciech > > Wed Jan 28 2015 at 3:55:12 AM u?ytkownik David Feuer > napisa?: > >> There used to be an external representation of core intended to be >> used for such things. It was recently removed because it had gotten >> stale and no one wanted to take responsibility for maintaining it. So >> at the moment, Core is really just an AST, not a proper language, and >> you'll have to hack GHC if you want to inject it. >> >> On Tue, Jan 27, 2015 at 6:10 PM, Wojciech Danilo >> wrote: >> > Hello All! :) >> > Recently I've came across a problem and hopefully you could help me with >> > it. >> > Basically I and some people here are running a startup and we have >> > created a >> > language for processing images. This language has 2 interchangeable >> > representations - textual and visual, dataflow one. >> > >> > Right now we are compiling it to haskell sources, but we want to move >> > over >> > GHC CORE. Getting into GHC has a high learning curve, as far as we see, >> > and >> > we would be very thankfull for any help with a minimal working example >> > of >> > compiling haskell sources to CORE and then CORE to binaries. I've posted >> > couple days ago a detailed question on StackOverflow, here: >> > >> > >> > http://stackoverflow.com/questions/28059669/using-ghc-api-to-compile-haskell-sources-to-core-and-core-to-binary >> > >> > >> > I would be very thankful for any help or hints! >> > All the best, >> > Wojciech >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> > From wojciech.danilo at gmail.com Wed Jan 28 04:06:07 2015 From: wojciech.danilo at gmail.com (Wojciech Danilo) Date: Wed, 28 Jan 2015 04:06:07 +0000 Subject: [Haskell-cafe] Using GHC API to compile Haskell sources to CORE and CORE to binary References: Message-ID: Ok, so things are not in such poor condition than I imagined after your first reply. Anyway I would be very thankful if anybody here would help me with a minimal example which compiles haskell sources to CoreSynType (or whatever core is encoded in) and then into binary - so I can inspect ghow core is generated and replace in the future by mu custom one :) Wed Jan 28 2015 at 4:53:01 AM u?ytkownik David Feuer napisa?: > I can't answer all those questions, but I believe CoreSynType is the > AST representing Core. > > On Tue, Jan 27, 2015 at 10:12 PM, Wojciech Danilo > wrote: > > Hello David, thank you for your response! :) > > I've got few questions regarding it: > > 1) Does it mean there are no datatypes dedicated to "a core language" ? > > 2) All passes are transforming AST -> AST? If so, what does the function > > `compileToCoreModule` does? > > 3) Additional - is there any subset of the AST that we can call "CORE" ? > > 4) Do all the documentation (like this one: > > https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/CoreSynType) > > should be considered obsolete? > > > > All the best, > > Wojciech > > > > Wed Jan 28 2015 at 3:55:12 AM u?ytkownik David Feuer < > david.feuer at gmail.com> > > napisa?: > > > >> There used to be an external representation of core intended to be > >> used for such things. It was recently removed because it had gotten > >> stale and no one wanted to take responsibility for maintaining it. So > >> at the moment, Core is really just an AST, not a proper language, and > >> you'll have to hack GHC if you want to inject it. > >> > >> On Tue, Jan 27, 2015 at 6:10 PM, Wojciech Danilo > >> wrote: > >> > Hello All! :) > >> > Recently I've came across a problem and hopefully you could help me > with > >> > it. > >> > Basically I and some people here are running a startup and we have > >> > created a > >> > language for processing images. This language has 2 interchangeable > >> > representations - textual and visual, dataflow one. > >> > > >> > Right now we are compiling it to haskell sources, but we want to move > >> > over > >> > GHC CORE. Getting into GHC has a high learning curve, as far as we > see, > >> > and > >> > we would be very thankfull for any help with a minimal working example > >> > of > >> > compiling haskell sources to CORE and then CORE to binaries. I've > posted > >> > couple days ago a detailed question on StackOverflow, here: > >> > > >> > > >> > http://stackoverflow.com/questions/28059669/using-ghc- > api-to-compile-haskell-sources-to-core-and-core-to-binary > >> > > >> > > >> > I would be very thankful for any help or hints! > >> > All the best, > >> > Wojciech > >> > > >> > _______________________________________________ > >> > Haskell-Cafe mailing list > >> > Haskell-Cafe at haskell.org > >> > http://www.haskell.org/mailman/listinfo/haskell-cafe > >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From agocorona at gmail.com Wed Jan 28 08:28:41 2015 From: agocorona at gmail.com (Alberto G. Corona ) Date: Wed, 28 Jan 2015 09:28:41 +0100 Subject: [Haskell-cafe] Tooling for equational reasoning in Haskell In-Reply-To: References: <54C6C3EC.9060409@vex.net> Message-ID: There is a interpreter of Haskell written in Maude: http://fsl.cs.illinois.edu/images/5/5f/Bennett-2006-tr.pdf Which potentially can do it, since Maude is an specificiation language based on rewriting logic. It has no IO neither has syntactic sugar for lists, type classes etc, But it is a different path to achieving this goal if someone is interested in developing it further 2015-01-27 11:35 GMT+01:00 Paul Brauner : > Stepeval is what Christopher pointed to in his first email, but he said it > only works on a teeny weeny subset of Haskell. > > On Tue Jan 27 2015 at 8:26:55 AM Sumit Sahrawat, Maths & Computing, IIT > (BHU) wrote: > >> I found https://github.com/bmillwood/stepeval, which evaluates >> expressions step-by-step. It might be possible to modify it for equational >> reasoning. >> >> On 27 January 2015 at 04:17, Albert Y. C. Lai wrote: >> >>> On 2015-01-18 06:46 PM, Christopher Done wrote: >>> >>>> I quite enjoy doing equational reasoning to prove that my functions >>>> satisfy some laws, I like to type out each substitution step until I get >>>> back what I started with. The only trouble is that it's rather manual and >>>> possibly error prone. >>>> >>>> Is there any tooling anywhere out there that can take in a Haskell >>>> expression and reduce it by one step? >>>> >>> >>> I suggest my friend Lev Naiman's proof assistant project "Netty" >>> https://bitbucket.org/naiman/nettyproject/overview >>> It is not specific to Haskell. It is a general-purpose calculational >>> proof assistant. >>> >>> If you want to take a look at a paper, it's somewhere on his home page: >>> http://www.cs.utoronto.ca/~naiman/ >> > >>> >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>> >> >> >> >> -- >> Regards >> >> Sumit Sahrawat >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -- Alberto. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominic at steinitz.org Wed Jan 28 09:06:50 2015 From: dominic at steinitz.org (Dominic Steinitz) Date: Wed, 28 Jan 2015 09:06:50 +0000 (UTC) Subject: [Haskell-cafe] =?utf-8?q?How_to_force_James_Cook_=28author_of_dep?= =?utf-8?q?endent-map=29=09evaluation=3F?= References: Message-ID: Alexey Uimanov gmail.com> writes: > Hello people. There is a pull request > https://github.com/mokus0/dependent-map/pull/2 which I need to be on > hackage. I have sent a email to mokus deepbondi.net but nothing > happened. Does anyone can contact with James and tell him about my > problem? > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > Hi Alexey, I have sporadically communicated with James in the past about random-fu. He is very busy (aren't we all) and he was happy for me take on maintainership of the package. I would suggest you send him an email offering to take on maintainership of dependent-map. He can then give you update access to the git repo and to hackage. If he doesn't respond (but I expect he will) then there is a process for taking on maintainership of a package where the author has disappeared. I think you email the libraries mailing list saying that is what you propose to do unless you hear from the author in say 2 weeks (just in case they are on holiday). Someone will then grant you access to hackage but you will have to fork the existing repo. HTH, Dominic. From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Wed Jan 28 09:19:47 2015 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Wed, 28 Jan 2015 09:19:47 +0000 Subject: [Haskell-cafe] Using GHC API to compile Haskell sources to CORE and CORE to binary In-Reply-To: References: Message-ID: <20150128091947.GC10648@weber> On Wed, Jan 28, 2015 at 04:06:07AM +0000, Wojciech Danilo wrote: > Ok, so things are not in such poor condition than I imagined after your > first reply. Anyway I would be very thankful if anybody here would help me > with a minimal example which compiles haskell sources to CoreSynType (or > whatever core is encoded in) and then into binary - so I can inspect ghow > core is generated and replace in the future by mu custom one :) I'm certainly no expert, but I remembered that the Haste compiler compiles Haskell via Core to STG, so this may give you a start: https://github.com/valderman/haste-compiler/blob/master/src/Main.hs#L181 Tom From agocorona at gmail.com Wed Jan 28 09:22:47 2015 From: agocorona at gmail.com (Alberto G. Corona ) Date: Wed, 28 Jan 2015 10:22:47 +0100 Subject: [Haskell-cafe] Tooling for equational reasoning in Haskell In-Reply-To: References: <54C6C3EC.9060409@vex.net> Message-ID: In the other side I?m after something somewhat related to that: A way to extract a machine-independent representation (for example, source code) of a piece of code at runtime in order to compile and run it in another computer (or a browser). This may sound crazy, but I think that enhancing the compiler with an option which maintain a pointer from each Haskell expression to his parsed source code and then using lazy rewriting to update the source code tree, it could be possible a great number of now unthinkable applications while running the code at compilation speeds: since very detailed debugging, teaching, mobile agents, code serialization, reflection... 2015-01-28 9:28 GMT+01:00 Alberto G. Corona : > There is a interpreter of Haskell written in Maude: > > http://fsl.cs.illinois.edu/images/5/5f/Bennett-2006-tr.pdf > > Which potentially can do it, since Maude is an specificiation language > based on rewriting logic. It has no IO neither has syntactic sugar for > lists, type classes etc, But it is a different path to achieving this goal > if someone is interested in developing it further > > > > 2015-01-27 11:35 GMT+01:00 Paul Brauner : > >> Stepeval is what Christopher pointed to in his first email, but he said >> it only works on a teeny weeny subset of Haskell. >> >> On Tue Jan 27 2015 at 8:26:55 AM Sumit Sahrawat, Maths & Computing, IIT >> (BHU) wrote: >> >>> I found https://github.com/bmillwood/stepeval, which evaluates >>> expressions step-by-step. It might be possible to modify it for equational >>> reasoning. >>> >>> On 27 January 2015 at 04:17, Albert Y. C. Lai wrote: >>> >>>> On 2015-01-18 06:46 PM, Christopher Done wrote: >>>> >>>>> I quite enjoy doing equational reasoning to prove that my functions >>>>> satisfy some laws, I like to type out each substitution step until I get >>>>> back what I started with. The only trouble is that it's rather manual and >>>>> possibly error prone. >>>>> >>>>> Is there any tooling anywhere out there that can take in a Haskell >>>>> expression and reduce it by one step? >>>>> >>>> >>>> I suggest my friend Lev Naiman's proof assistant project "Netty" >>>> https://bitbucket.org/naiman/nettyproject/overview >>>> It is not specific to Haskell. It is a general-purpose calculational >>>> proof assistant. >>>> >>>> If you want to take a look at a paper, it's somewhere on his home page: >>>> http://www.cs.utoronto.ca/~naiman/ >>> 7Enaiman/> >>>> >>>> >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>>> >>> >>> >>> >>> -- >>> Regards >>> >>> Sumit Sahrawat >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > > > -- > Alberto. > -- Alberto. -------------- next part -------------- An HTML attachment was scrubbed... URL: From polux2001 at gmail.com Wed Jan 28 09:27:30 2015 From: polux2001 at gmail.com (Paul Brauner) Date: Wed, 28 Jan 2015 09:27:30 +0000 Subject: [Haskell-cafe] runSubStateT References: Message-ID: Yes, I remember seeing a talk by Edward Kmett (at some Scala user group I think) where he said lenses allowed you to focus on a substate in the state monad. Paul On Tue Jan 27 2015 at 11:21:35 PM PkmX wrote: > Isn't this exactly what the `zoom` function does from `Control.Lens.Zoom`? > > > flip execState (1, 1) $ zoom _1 $ modify succ > (2, 1) > > On Wed, Jan 28, 2015 at 6:14 AM, Christopher Done > wrote: > > runSubStateT :: Monad m > > => (s -> s') -> (s' -> s) -> StateT s' m a -> StateT s m a > > runSubStateT to from m = > > StateT (\s -> > > liftM (\(a,s') -> (a,from s')) > > (runStateT m (to s))) > > > > Anyone ever needed something like this? Does it already exist in some > > form in the standard libraries? > > > > Ciao > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -- > Chih-Mao Chen (PkmX) > System Software Laboratory > Department of Computer Science > National Chiao Tung University > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dons00 at gmail.com Wed Jan 28 12:09:10 2015 From: dons00 at gmail.com (Don Stewart) Date: Wed, 28 Jan 2015 12:09:10 +0000 Subject: [Haskell-cafe] Contracting Haskell dev role at Standard Chartered Message-ID: The Strats team at Standard Chartered is hiring a developer for a 1 year contracting role in London. The role is to develop and extend our parsing and validation library for FpML, using the FpML Haskell library to parse and build financial product data into our internal Haskell data types. You will extend our library to support more products, as well as building testing and validation tools (e.g. in QuickCheck) to confirm the soundness and completeness of the implementation. This is a rare entry level Haskell role, and you'll join a very experienced team. More details at: https://donsbot.wordpress.com/2015/01/28/contracting-haskell-development-role-at-standard-chartered/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From eir at cis.upenn.edu Wed Jan 28 12:41:39 2015 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Wed, 28 Jan 2015 07:41:39 -0500 Subject: [Haskell-cafe] Using GHC API to compile Haskell sources to CORE and CORE to binary In-Reply-To: References: Message-ID: <7A662404-2642-420B-8E66-22CAA113756F@cis.upenn.edu> I have plenty of experience with GHC Core, but none with the GHC API. I'll explain what I know. GHC's Core language is alive and very well. It's described in many academic papers -- "Giving Haskell a Promotion" and "Safe Zero-Cost Coercions for Haskell" both contain nice descriptions of a theoretical version of the language. The actual language as implemented is described in https://github.com/ghc/ghc/blob/master/docs/core-spec/core-spec.pdf?raw=true though that is quite terse. Expressions in Core are stored in the CoreExpr type, types are the Type type, and coercions are the Coercion type. The file coreSyn/CoreLint.hs performs typechecking over this language. A desugared module is written in Core. If you know how to manipulate the GHC API into producing a desugared module (a ModGuts, I believe), you have a Core program. Alternatively, you can create your own ModGuts somehow, and then perhaps convince the GHC API to carry on with it. Core is used for all of GHC's internal manipulations: simplifying & optimization. The fact that it's typechecked is a critical sanity check on GHC itself -- we want to know if a transformation changes any types! (They shouldn't.) External Core, on the other hand, was a project that lived for some time, allowing a command-line interface for injecting Core into GHC, without even the GHC API. It had a printer and a parser. However, it bitrotted over the years and was recently removed, as the rot showed that no one was actually using it. However, if you are using the GHC API, I don't think that the lack of External Core should be an issue. I believe External Core's salient feature was its parser, and you don't need that as an API user. I hope this is helpful! Richard On Jan 27, 2015, at 6:10 PM, Wojciech Danilo wrote: > Hello All! :) > Recently I've came across a problem and hopefully you could help me with it. Basically I and some people here are running a startup and we have created a language for processing images. This language has 2 interchangeable representations - textual and visual, dataflow one. > > Right now we are compiling it to haskell sources, but we want to move over GHC CORE. Getting into GHC has a high learning curve, as far as we see, and we would be very thankfull for any help with a minimal working example of compiling haskell sources to CORE and then CORE to binaries. I've posted couple days ago a detailed question on StackOverflow, here: > > http://stackoverflow.com/questions/28059669/using-ghc-api-to-compile-haskell-sources-to-core-and-core-to-binary > > > I would be very thankful for any help or hints! > All the best, > Wojciech > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From ratzes at gmail.com Wed Jan 28 14:33:11 2015 From: ratzes at gmail.com (Charles Durham) Date: Wed, 28 Jan 2015 09:33:11 -0500 Subject: [Haskell-cafe] Representation of lenses In-Reply-To: References: Message-ID: glad that helped, definitely helped me On Tue, Jan 27, 2015 at 3:29 PM, David Turner wrote: > On 27 January 2015 at 17:23, Charles Durham wrote: > > You need to sign up for it, but this is a phenomenal talk by simon peyton > > jones describing the idea behind lenses the way he understood it. > > > > > https://skillsmatter.com/skillscasts/4251-lenses-compositional-data-access-and-manipulation > > Thanks, I think that was exactly what I needed to know. > > If I understand the key section right, you can do all that stuff with > a straight get/set pair but it'd be desperately inefficient, so then > you add an update function, and then one at Maybe and [] and IO and > they all start to look the same so you generalise to all Functors, and > then you discover that using Const you get a getter, and Identity > gives you a setter, so you can throw them away and end up with a lens > as we know it. > > And then you generalise it in about a billion other directions and you > end up with the lens library! > > Much obliged, > > David > -------------- next part -------------- An HTML attachment was scrubbed... URL: From timotej.tomandl at gmail.com Wed Jan 28 17:22:37 2015 From: timotej.tomandl at gmail.com (Timotej Tomandl) Date: Wed, 28 Jan 2015 18:22:37 +0100 Subject: [Haskell-cafe] Pure functional and pure logical language at the same time Message-ID: This question was bugging me for quite a long time. Can we have a language which uses the functional logic while being both pure functional and pure logical? Do we get any advantages from maintaining both both of this purities at the same time? P.S.: I have feeling the answer is no, but I am not sure. -------------- next part -------------- An HTML attachment was scrubbed... URL: From joehillen at gmail.com Wed Jan 28 17:37:00 2015 From: joehillen at gmail.com (Joe Hillenbrand) Date: Wed, 28 Jan 2015 09:37:00 -0800 Subject: [Haskell-cafe] Pure functional and pure logical language at the same time In-Reply-To: References: Message-ID: What does "pure logical" mean? On Wed, Jan 28, 2015 at 9:22 AM, Timotej Tomandl wrote: > This question was bugging me for quite a long time. Can we have a language > which uses the functional logic while being both pure functional and pure > logical? > Do we get any advantages from maintaining both both of this purities at > the same time? > > P.S.: I have feeling the answer is no, but I am not sure. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.j.thompson at kent.ac.uk Wed Jan 28 17:56:07 2015 From: s.j.thompson at kent.ac.uk (Simon Thompson) Date: Wed, 28 Jan 2015 17:56:07 +0000 Subject: [Haskell-cafe] Pure functional and pure logical language at the same time In-Reply-To: References: Message-ID: <57E687C8-6331-4C55-ABA3-3033CFF71255@kent.ac.uk> You need to take a look at curry ? http://www-ps.informatik.uni-kiel.de/currywiki/start Simon > On 28 Jan 2015, at 17:37, Joe Hillenbrand wrote: > > What does "pure logical" mean? > > On Wed, Jan 28, 2015 at 9:22 AM, Timotej Tomandl > wrote: > This question was bugging me for quite a long time. Can we have a language which uses the functional logic while being both pure functional and pure logical? > Do we get any advantages from maintaining both both of this purities at the same time? > > P.S.: I have feeling the answer is no, but I am not sure. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson at kent.ac.uk | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt -------------- next part -------------- An HTML attachment was scrubbed... URL: From 0xbadcode at gmail.com Wed Jan 28 18:09:01 2015 From: 0xbadcode at gmail.com (Mathieu Boespflug) Date: Wed, 28 Jan 2015 19:09:01 +0100 Subject: [Haskell-cafe] Pure functional and pure logical language at the same time In-Reply-To: References: Message-ID: By "pure logical", do you mean "logically consistent"? Or do you mean a logic language in the style of Prolog but with no non-logical effects such as programmatic pruning of the search tree? If the former, there are many languages in that fit the bill (or at least are believed to be consistent): Coq, Agda, HOL, ... The key difference between those languages and Haskell is that all functions must be provably total. See https://uf-ias-2012.wikispaces.com/file/view/turner.pdf from the father of a direct ancestor of Haskell, arguing for precisely this: a total functional programming language (not that I agree that such a language as proposed in the paper would be particularly useful). If you mean the former, there are language that try to combine logical and functional programming, see e.g. Curry just mentioned in this thread a few minutes ago. On 28 January 2015 at 18:22, Timotej Tomandl wrote: > This question was bugging me for quite a long time. Can we have a language > which uses the functional logic while being both pure functional and pure > logical? > Do we get any advantages from maintaining both both of this purities at the > same time? > > P.S.: I have feeling the answer is no, but I am not sure. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From timotej.tomandl at gmail.com Wed Jan 28 18:22:32 2015 From: timotej.tomandl at gmail.com (Timotej Tomandl) Date: Wed, 28 Jan 2015 19:22:32 +0100 Subject: [Haskell-cafe] Pure functional and pure logical language at the same time In-Reply-To: References: Message-ID: By pure logical I mean having features like in Pure Prolog. I am not sure if Curry is pure functional or not. Is it? 2015-01-28 19:09 GMT+01:00 Mathieu Boespflug <0xbadcode at gmail.com>: > By "pure logical", do you mean "logically consistent"? Or do you mean > a logic language in the style of Prolog but with no non-logical > effects such as programmatic pruning of the search tree? > > If the former, there are many languages in that fit the bill (or at > least are believed to be consistent): Coq, Agda, HOL, ... The key > difference between those languages and Haskell is that all functions > must be provably total. See > > https://uf-ias-2012.wikispaces.com/file/view/turner.pdf > > from the father of a direct ancestor of Haskell, arguing for precisely > this: a total functional programming language (not that I agree that > such a language as proposed in the paper would be particularly > useful). > > If you mean the former, there are language that try to combine logical > and functional programming, see e.g. Curry just mentioned in this > thread a few minutes ago. > > > On 28 January 2015 at 18:22, Timotej Tomandl > wrote: > > This question was bugging me for quite a long time. Can we have a > language > > which uses the functional logic while being both pure functional and pure > > logical? > > Do we get any advantages from maintaining both both of this purities at > the > > same time? > > > > P.S.: I have feeling the answer is no, but I am not sure. > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at adradh.org.uk Wed Jan 28 18:27:45 2015 From: andy at adradh.org.uk (Andy Morris) Date: Wed, 28 Jan 2015 19:27:45 +0100 Subject: [Haskell-cafe] Pure functional and pure logical language at the same time In-Reply-To: References: Message-ID: Yes. It has monadic IO exactly like Haskell's. > On 28 Jan 2015, at 19:22, Timotej Tomandl wrote: > > By pure logical I mean having features like in Pure Prolog. > I am not sure if Curry is pure functional or not. Is it? > > > > 2015-01-28 19:09 GMT+01:00 Mathieu Boespflug <0xbadcode at gmail.com >: > By "pure logical", do you mean "logically consistent"? Or do you mean > a logic language in the style of Prolog but with no non-logical > effects such as programmatic pruning of the search tree? > > If the former, there are many languages in that fit the bill (or at > least are believed to be consistent): Coq, Agda, HOL, ... The key > difference between those languages and Haskell is that all functions > must be provably total. See > > https://uf-ias-2012.wikispaces.com/file/view/turner.pdf > > from the father of a direct ancestor of Haskell, arguing for precisely > this: a total functional programming language (not that I agree that > such a language as proposed in the paper would be particularly > useful). > > If you mean the former, there are language that try to combine logical > and functional programming, see e.g. Curry just mentioned in this > thread a few minutes ago. > > > On 28 January 2015 at 18:22, Timotej Tomandl > wrote: > > This question was bugging me for quite a long time. Can we have a language > > which uses the functional logic while being both pure functional and pure > > logical? > > Do we get any advantages from maintaining both both of this purities at the > > same time? > > > > P.S.: I have feeling the answer is no, but I am not sure. > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From timotej.tomandl at gmail.com Wed Jan 28 18:37:20 2015 From: timotej.tomandl at gmail.com (Timotej Tomandl) Date: Wed, 28 Jan 2015 19:37:20 +0100 Subject: [Haskell-cafe] Pure functional and pure logical language at the same time In-Reply-To: References: Message-ID: Second thing, is it purely logical? And do we get any advantage when reasoning? 2015-01-28 19:27 GMT+01:00 Andy Morris : > Yes. It has monadic IO exactly like Haskell's. > > On 28 Jan 2015, at 19:22, Timotej Tomandl > wrote: > > By pure logical I mean having features like in Pure Prolog. > I am not sure if Curry is pure functional or not. Is it? > > > > 2015-01-28 19:09 GMT+01:00 Mathieu Boespflug <0xbadcode at gmail.com>: > >> By "pure logical", do you mean "logically consistent"? Or do you mean >> a logic language in the style of Prolog but with no non-logical >> effects such as programmatic pruning of the search tree? >> >> If the former, there are many languages in that fit the bill (or at >> least are believed to be consistent): Coq, Agda, HOL, ... The key >> difference between those languages and Haskell is that all functions >> must be provably total. See >> >> https://uf-ias-2012.wikispaces.com/file/view/turner.pdf >> >> from the father of a direct ancestor of Haskell, arguing for precisely >> this: a total functional programming language (not that I agree that >> such a language as proposed in the paper would be particularly >> useful). >> >> If you mean the former, there are language that try to combine logical >> and functional programming, see e.g. Curry just mentioned in this >> thread a few minutes ago. >> >> >> On 28 January 2015 at 18:22, Timotej Tomandl >> wrote: >> > This question was bugging me for quite a long time. Can we have a >> language >> > which uses the functional logic while being both pure functional and >> pure >> > logical? >> > Do we get any advantages from maintaining both both of this purities at >> the >> > same time? >> > >> > P.S.: I have feeling the answer is no, but I am not sure. >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> > >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From timotej.tomandl at gmail.com Wed Jan 28 18:41:15 2015 From: timotej.tomandl at gmail.com (Timotej Tomandl) Date: Wed, 28 Jan 2015 19:41:15 +0100 Subject: [Haskell-cafe] Pure functional and pure logical language at the same time In-Reply-To: References: Message-ID: I think I found the advantage it can give us abbility to combine inductive and deductive reasoning. 2015-01-28 19:37 GMT+01:00 Timotej Tomandl : > Second thing, is it purely logical? > And do we get any advantage when reasoning? > > 2015-01-28 19:27 GMT+01:00 Andy Morris : > >> Yes. It has monadic IO exactly like Haskell's. >> >> On 28 Jan 2015, at 19:22, Timotej Tomandl >> wrote: >> >> By pure logical I mean having features like in Pure Prolog. >> I am not sure if Curry is pure functional or not. Is it? >> >> >> >> 2015-01-28 19:09 GMT+01:00 Mathieu Boespflug <0xbadcode at gmail.com>: >> >>> By "pure logical", do you mean "logically consistent"? Or do you mean >>> a logic language in the style of Prolog but with no non-logical >>> effects such as programmatic pruning of the search tree? >>> >>> If the former, there are many languages in that fit the bill (or at >>> least are believed to be consistent): Coq, Agda, HOL, ... The key >>> difference between those languages and Haskell is that all functions >>> must be provably total. See >>> >>> https://uf-ias-2012.wikispaces.com/file/view/turner.pdf >>> >>> from the father of a direct ancestor of Haskell, arguing for precisely >>> this: a total functional programming language (not that I agree that >>> such a language as proposed in the paper would be particularly >>> useful). >>> >>> If you mean the former, there are language that try to combine logical >>> and functional programming, see e.g. Curry just mentioned in this >>> thread a few minutes ago. >>> >>> >>> On 28 January 2015 at 18:22, Timotej Tomandl >>> wrote: >>> > This question was bugging me for quite a long time. Can we have a >>> language >>> > which uses the functional logic while being both pure functional and >>> pure >>> > logical? >>> > Do we get any advantages from maintaining both both of this purities >>> at the >>> > same time? >>> > >>> > P.S.: I have feeling the answer is no, but I am not sure. >>> > >>> > _______________________________________________ >>> > Haskell-Cafe mailing list >>> > Haskell-Cafe at haskell.org >>> > http://www.haskell.org/mailman/listinfo/haskell-cafe >>> > >>> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From anthony_clayden at clear.net.nz Thu Jan 29 08:47:25 2015 From: anthony_clayden at clear.net.nz (AntC) Date: Thu, 29 Jan 2015 08:47:25 +0000 (UTC) Subject: [Haskell-cafe] Fwd: Announcing a solution to the records problem References: Message-ID: > Christopher Done gmail.com> writes: (Thanks Chris for suggesting the cafe might be a place to discuss this.) I'm replying to your/Nikita's latest on ghc-devs. > On Wed, Jan 28, 2015 at 4:48 PM, Nikita Volkov wrote: > > Chris, this is great! Looks like we can even get rid of the Rec prefix! But, but! If we want anonymous records, whose syntax is round brackets, who don't want even a constructor, we can do that already: newtype X = X Coord; newtype Y = Y Coord; point2D = (X 1, Y 1) X # point2D (I'm using (#) as the operator, but could be anything.) class Has r l a | r l -> a where (#) :: l -> r -> a instance Has (l, l2) (a -> l) a where _ # (x, _) = unL x OK. The instances are yucky (and overlap). (And need UndecideableInstances so can't be done as type families.) But they can all be defined once in the library, up to some ridiculous size of tuples. Generating the newtype decls and their UnL instance seems like a job for TH. We can get more label-like with: newtype Z a = Z a instance (a' ~ a) => Has (l a', l2, l3) (a -> l a) a' where _ # (x, _, _) = unL x Z # (Z 7, X 1, Y 1) (There's also the awkward oneple's to find nice syntax for.) >> 2015-01-29 0:26 GMT+03:00 Christopher Done : >> >> There?s too much to absorb in this discussion at the moment ... (+1) >> Given that this is very similar to TRex ... >> >> type Point2D = Rec (x::Coord, y::Coord) >> point2D = (x=1, y=1) :: Point2D >> (#x point) AntC From nickolay.kudasov at gmail.com Thu Jan 29 20:14:50 2015 From: nickolay.kudasov at gmail.com (Nickolay Kudasov) Date: Fri, 30 Jan 2015 00:14:50 +0400 Subject: [Haskell-cafe] Pure functional and pure logical language at the same time In-Reply-To: References: Message-ID: Hello! Disclaimer: I have not worked in either of the languages I am talking about (Curry, Mercury). Curry is logical, but it uses different logic mechanisms than Prolog. Curry is using something called "narrowing" which is very different to Prolog's SLD-resolution. AFAICT narrowing (or needed narrowing) corresponds to lazy evaluation while SLD-resolution corresponds to strict evaluation. Mercury is another language to combine functional and logical features. But while Curry is Haskell-based with added mechanism of narrowing, Mercury is Prolog-based with Haskell-like type system. As Mercury is based on Prolog, there is an interesting part of a type system that corresponds to in/out parameters of a predicate. A predicate may also have multiple type signatures (since a some parameters may be in/out switched). The way Mercury treats IO in a pure way is also interesting (IIRC it uses something called unique parameter for the World). I see both languages as "pure". Both languages have pure functional parts (deterministic functions in Curry and function signatures in Mercury). I may be wrong, but it seems that of those two languages Mercury is a bit "more alive". Best, Nick 2015-01-28 21:37 GMT+03:00 Timotej Tomandl : > Second thing, is it purely logical? > And do we get any advantage when reasoning? > > 2015-01-28 19:27 GMT+01:00 Andy Morris : > >> Yes. It has monadic IO exactly like Haskell's. >> >> On 28 Jan 2015, at 19:22, Timotej Tomandl >> wrote: >> >> By pure logical I mean having features like in Pure Prolog. >> I am not sure if Curry is pure functional or not. Is it? >> >> >> >> 2015-01-28 19:09 GMT+01:00 Mathieu Boespflug <0xbadcode at gmail.com>: >> >>> By "pure logical", do you mean "logically consistent"? Or do you mean >>> a logic language in the style of Prolog but with no non-logical >>> effects such as programmatic pruning of the search tree? >>> >>> If the former, there are many languages in that fit the bill (or at >>> least are believed to be consistent): Coq, Agda, HOL, ... The key >>> difference between those languages and Haskell is that all functions >>> must be provably total. See >>> >>> https://uf-ias-2012.wikispaces.com/file/view/turner.pdf >>> >>> from the father of a direct ancestor of Haskell, arguing for precisely >>> this: a total functional programming language (not that I agree that >>> such a language as proposed in the paper would be particularly >>> useful). >>> >>> If you mean the former, there are language that try to combine logical >>> and functional programming, see e.g. Curry just mentioned in this >>> thread a few minutes ago. >>> >>> >>> On 28 January 2015 at 18:22, Timotej Tomandl >>> wrote: >>> > This question was bugging me for quite a long time. Can we have a >>> language >>> > which uses the functional logic while being both pure functional and >>> pure >>> > logical? >>> > Do we get any advantages from maintaining both both of this purities >>> at the >>> > same time? >>> > >>> > P.S.: I have feeling the answer is no, but I am not sure. >>> > >>> > _______________________________________________ >>> > Haskell-Cafe mailing list >>> > Haskell-Cafe at haskell.org >>> > http://www.haskell.org/mailman/listinfo/haskell-cafe >>> > >>> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at orlitzky.com Thu Jan 29 22:59:57 2015 From: michael at orlitzky.com (Michael Orlitzky) Date: Thu, 29 Jan 2015 17:59:57 -0500 Subject: [Haskell-cafe] Compiling Setup.hs with -threaded Message-ID: <54CABB6D.8020300@orlitzky.com> I found a weird bug at, https://bugs.gentoo.org/show_bug.cgi?id=537500 There is an awesome tool called shellcheck: git clone https://github.com/koalaman/shellcheck.git and we want to run its test suite. Basically: * If you run the test suite using runghc, then it works fine. * If you compile Setup.hs to setup, then the test suite hangs. * But if you compile Setup.hs to setup using -threaded, it works? Normally I would blabber on about what I think the problem could be, but the WTF factor here is just too high. Should we (always?) be compiling Setup.hs with -threaded? Or is this a bug in the runtime or a library or REALITY ITSELF? From allbery.b at gmail.com Thu Jan 29 23:12:20 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Thu, 29 Jan 2015 18:12:20 -0500 Subject: [Haskell-cafe] Compiling Setup.hs with -threaded In-Reply-To: <54CABB6D.8020300@orlitzky.com> References: <54CABB6D.8020300@orlitzky.com> Message-ID: On Thu, Jan 29, 2015 at 5:59 PM, Michael Orlitzky wrote: > and we want to run its test suite. Basically: > > * If you run the test suite using runghc, then it works fine. > * If you compile Setup.hs to setup, then the test suite hangs. > * But if you compile Setup.hs to setup using -threaded, it works? > IIRC bytecode (runghc, ghci) always uses the threaded runtime, and this problem can be a symptom of an FFI call that can block but wasn't declared as potentially blocking; so the runtime calls it expecting it to not block and the program freezes when it does block. In the threaded runtime, other OS threads can continue executing in this case; in the non-threaded runtime, this will block the "green" thread scheduler. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From fa-ml at ariis.it Fri Jan 30 20:26:39 2015 From: fa-ml at ariis.it (Francesco Ariis) Date: Fri, 30 Jan 2015 21:26:39 +0100 Subject: [Haskell-cafe] Using m4 as a preprocessor Message-ID: <20150130202639.GA10428@x60s.casa> Hello, today I tried to compile a Haskell program using m4 as preprocessor, with the {-# OPTIONS_GHC -F -pgmF m4 #-} pragma on top of a .hs file. I didn't add anything else, there are no ''' or '`' in the source. Upon compiling, ghc (7.8.3) complains: m4: cannot open `/tmp/ghc10655_0/ghc10655_1.hspp': No such file or directory I searched the net for a solution, but no dice (apparently there are no Haskell programs using -F -pgmF m4?), so I am writing here. Any ideas on what is wrong? From allbery.b at gmail.com Fri Jan 30 20:48:41 2015 From: allbery.b at gmail.com (Brandon Allbery) Date: Fri, 30 Jan 2015 15:48:41 -0500 Subject: [Haskell-cafe] Using m4 as a preprocessor In-Reply-To: <20150130202639.GA10428@x60s.casa> References: <20150130202639.GA10428@x60s.casa> Message-ID: On Fri, Jan 30, 2015 at 3:26 PM, Francesco Ariis wrote: > pragma on top of a .hs file. I didn't add anything else, there are no > ''' or '`' in the source. Upon compiling, ghc (7.8.3) complains: > > m4: cannot open `/tmp/ghc10655_0/ghc10655_1.hspp': No such file or > directory > > I searched the net for a solution, but no dice (apparently there are no > Haskell programs using -F -pgmF m4?), so I am writing here. > Any ideas on what is wrong? > "Use -pgmF *cmd* to select the program to use as the preprocessor. When invoked, the *cmd* pre-processor is given at least three arguments on its command-line: the first argument is the name of the original source file, the second is the name of the file holding the input, and the third is the name of the file where *cmd*should write its output to." m4 won't process those parameters the way ghc expects; you'll need a wrapper script. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From claude at mathr.co.uk Fri Jan 30 20:49:07 2015 From: claude at mathr.co.uk (Claude Heiland-Allen) Date: Fri, 30 Jan 2015 20:49:07 +0000 Subject: [Haskell-cafe] Using m4 as a preprocessor In-Reply-To: <20150130202639.GA10428@x60s.casa> References: <20150130202639.GA10428@x60s.casa> Message-ID: <54CBEE43.6050701@mathr.co.uk> Hi Francesco, On 30/01/15 20:26, Francesco Ariis wrote: > Hello, > today I tried to compile a Haskell program using m4 as preprocessor, > with the > > {-# OPTIONS_GHC -F -pgmF m4 #-} > > pragma on top of a .hs file. I didn't add anything else, there are no > ''' or '`' in the source. Upon compiling, ghc (7.8.3) complains: > > m4: cannot open `/tmp/ghc10655_0/ghc10655_1.hspp': No such file or directory > > I searched the net for a solution, but no dice (apparently there are no > Haskell programs using -F -pgmF m4?), so I am writing here. > Any ideas on what is wrong? Probably the missing file is where the preprocessor should store the output. Probably you need to write a wrapper script. See: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/options-phases.html#pre-processor Claude -- http://mathr.co.uk From trebla at vex.net Fri Jan 30 22:03:08 2015 From: trebla at vex.net (Albert Y. C. Lai) Date: Fri, 30 Jan 2015 17:03:08 -0500 Subject: [Haskell-cafe] Creating a list with do notation In-Reply-To: References: Message-ID: <54CBFF9C.90408@vex.net> On 2015-01-22 11:04 PM, Cody Goodman wrote: > List is a monad, does that mean i can create a list with do notation? My http://www.vex.net/~trebla/haskell/forwardconstraint/ForwardConstraint.html is a great example. The source code is behind some link at the top. From carter.schonwald at gmail.com Fri Jan 30 23:04:05 2015 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Fri, 30 Jan 2015 18:04:05 -0500 Subject: [Haskell-cafe] How to force James Cook (author of dependent-map) evaluation? In-Reply-To: References: Message-ID: the time scale for taking over maintainership without author authorization is MUCh longer than 2 weeks. IF you just need to get some simple patch level bug fix improvements, that is when the hackage trustees can help and get those changes on hackage while respecting the possibility of the author eventually emerging again. cheers -Carter On Wed, Jan 28, 2015 at 4:06 AM, Dominic Steinitz wrote: > Alexey Uimanov gmail.com> writes: > > > Hello people. There is a pull request > > https://github.com/mokus0/dependent-map/pull/2 which I need to be on > > hackage. I have sent a email to mokus deepbondi.net but nothing > > happened. Does anyone can contact with James and tell him about my > > problem? > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > > Hi Alexey, > > I have sporadically communicated with James in the past about > random-fu. He is very busy (aren't we all) and he was happy for me > take on maintainership of the package. I would suggest you send him an > email offering to take on maintainership of dependent-map. He can then > give you update access to the git repo and to hackage. > > If he doesn't respond (but I expect he will) then there is a process > for taking on maintainership of a package where the author has > disappeared. I think you email the libraries mailing list saying that > is what you propose to do unless you hear from the author in say 2 > weeks (just in case they are on holiday). Someone will then grant you > access to hackage but you will have to fork the existing repo. > > HTH, Dominic. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fa-ml at ariis.it Fri Jan 30 23:08:30 2015 From: fa-ml at ariis.it (Francesco Ariis) Date: Sat, 31 Jan 2015 00:08:30 +0100 Subject: [Haskell-cafe] Using m4 as a preprocessor In-Reply-To: <54CBEE43.6050701@mathr.co.uk> References: <20150130202639.GA10428@x60s.casa> <54CBEE43.6050701@mathr.co.uk> Message-ID: <20150130230830.GA16924@x60s.casa> On Fri, Jan 30, 2015 at 08:49:07PM +0000, Claude Heiland-Allen wrote: > Probably the missing file is where the preprocessor should store the > output. Probably you need to write a wrapper script. See: > > https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/options-phases.html#pre-processor Woops, must have missed that section, thanks! From takenobu.hs at gmail.com Sat Jan 31 01:10:00 2015 From: takenobu.hs at gmail.com (Takenobu Tani) Date: Sat, 31 Jan 2015 10:10:00 +0900 Subject: [Haskell-cafe] ANN: processor-creative-kit Message-ID: Dear Haskellers, I am pleased to announce the first release of processor-creative-kit package for playing processors. You can create your processors with your own instruction set. It simulates a simple microprocessor(cpu) with some development tools. https://hackage.haskell.org/package/processor-creative-kit https://github.com/takenobu-hs/processor-creative-kit feature: * easy try, easy modify * a purely functional CPU core (without IO) * including a very simple prototype assembler * including a very simple prototype profiler * including a very simple prototype debugger Thank you, Takenobu -------------- next part -------------- An HTML attachment was scrubbed... URL: From dct25-561bs at mythic-beasts.com Sat Jan 31 08:31:20 2015 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Sat, 31 Jan 2015 08:31:20 +0000 Subject: [Haskell-cafe] Side conditions on Data.Profunctor.Choice? Message-ID: Hi, I was expecting to see coherence conditions for instances of Data.Profunctor.Choice along the lines of: dimap (either (Left . f) Right) id . right' === dimap id (either (Left . f) Right) . right' and similarly for left', but there's nothing like that in the docs. Does anyone know whether (a) those conditions aren't true in general, or (b) they are true but provable from other theorems so not worth mentioning? Many thanks, David From reilithion at gmail.com Sat Jan 31 21:02:16 2015 From: reilithion at gmail.com (Lucas Paul) Date: Sat, 31 Jan 2015 14:02:16 -0700 Subject: [Haskell-cafe] Cabal config file - default install flags? Message-ID: I'd like to have cabal automatically use -j8 when I cabal install something. Is there something I can put into the .cabal/config file that will accomplish this? More generally, where can I find documentation on that config file? - Lucas Paul From k-bx at k-bx.com Sat Jan 31 22:15:16 2015 From: k-bx at k-bx.com (Konstantine Rybnikov) Date: Sun, 1 Feb 2015 00:15:16 +0200 Subject: [Haskell-cafe] Cabal config file - default install flags? In-Reply-To: References: Message-ID: Hi Lucas. Just put `jobs: $ncpus` into your ~/.cabal/config wile. I believe documentation is somewhere inside cabal manual, please take a look there. Hope this helps. On Sat, Jan 31, 2015 at 11:02 PM, Lucas Paul wrote: > I'd like to have cabal automatically use -j8 when I cabal install > something. Is there something I can put into the .cabal/config file > that will accomplish this? > > More generally, where can I find documentation on that config file? > > - Lucas Paul > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: