Re: [Haskell-cafe] commutative monoid?

2011-06-25 Thread wren ng thornton
On 6/25/11 1:34 AM, Evan Laforge wrote: So there's a range of possible Monoid instances for each type, More for some types than for others. For Maybe there are three: * always take the first/left value; * always take the last/right value; * or, use a semigroup operation defined on the

[Haskell-cafe] Haskell Logo

2011-06-25 Thread Michael Xavier
I wondered if anyone knew the legalities of using the haskell logo, in particular, this one: http://media.nokrev.com/junk/haskell-logos/logo1.png on a website, a personal blog in particular. While I am not yet a primarily haskell coder, I'm using it more and more. I find this logo in particular

Re: [Haskell-cafe] Software patents covered in GHC?

2011-06-25 Thread Erik de Castro Lopo
Manuel M T Chakravarty wrote: That's right, but it doesn't help any of us anything. The costs of defending against a patent claim (even if the claim can eventually be overturned) are much to high to bear for anybody, but major corporations. In other words, it doesn't matter if you are

Re: [Haskell-cafe] Iteratee IO examples

2011-06-25 Thread John Lato
From: Eric Rasmussen ericrasmus...@gmail.com Hi, Examples are very helpful to me too -- thank you for sharing. I'm especially curious to see if there are any examples that allow you to use or convert non-iteratee-based functions. I have only just begun reading about iteratees and might

Re: [Haskell-cafe] Haskell Logo

2011-06-25 Thread Daniel van den Eijkel
http://en.wikipedia.org/wiki/File:Haskell-Logo.svg cheers daniel Am 6/25/11 8:18 AM, schrieb Michael Xavier: I wondered if anyone knew the legalities of using the haskell logo, in particular, this one: http://media.nokrev.com/junk/haskell-logos/logo1.png on a website, a personal blog in

[Haskell-cafe] What is a simple pattern binding?

2011-06-25 Thread dm-list-haskell-cafe
Section 4.4.3.2 of the 2010 Haskell report says: A simple pattern binding has form p = e. The pattern p is matched “lazily” as an irrefutable pattern, as if there were an implicit ~ in front of it. This makes it sound as though p is a pattern, which I assume means what

Re: [Haskell-cafe] commutative monoid?

2011-06-25 Thread Evan Laforge
So is there a typeclass for that? There might be one hidden in one of the attempts at redesigning the numeric hierarchy (e.g., Numeric Prelude), but there's not a canonical typeclass for them. Unfortunately it's not really a good match for the typeclass system since it doesn't introduce any

[Haskell-cafe] Map Monoid instance (was commutative monoid?)

2011-06-25 Thread Jens Blanck
I don't think the original question really is about commutativity, but rather the choice of Monoid instance. Not being especially mathematically inclined, every once and a while I get a little panicked when I notice that, e.g. Data.Map mappend is a plain left-biased union, and doesn't actually

Re: [Haskell-cafe] Why aren't there anonymous sum types in Haskell?

2011-06-25 Thread Anton Nikishaev
Arlen Cuss cel...@sairyx.org writes: import Data.Either type (:|:) a b = Either a b (???) = either foo :: (Int :|: Bool :|: String :|: Double) - Int foo = \ i - i + 7 ??? \ b - if b then 1 else 0 ??? \ s - length s ??? \ d - floor d INFIX TYPE OPERATORS!!??!

Re: [Haskell-cafe] Map Monoid instance (was commutative monoid?)

2011-06-25 Thread Evan Laforge
On Sat, Jun 25, 2011 at 9:00 AM, Jens Blanck jens.bla...@gmail.com wrote: I don't think the original question really is about commutativity, but rather the choice of Monoid instance. Well, it was about two things, and that was one of them :) So there's a range of possible Monoid instances

Re: [Haskell-cafe] Map Monoid instance (was commutative monoid?)

2011-06-25 Thread Erik Hesselink
On Sat, Jun 25, 2011 at 19:07, Evan Laforge qdun...@gmail.com wrote: On Sat, Jun 25, 2011 at 9:00 AM, Jens Blanck jens.bla...@gmail.com wrote: So there's a range of possible Monoid instances for each type, More for some types than for others. For Maybe there are three:  * always take the

Re: [Haskell-cafe] What is a simple pattern binding?

2011-06-25 Thread Scott Turner
On 2011-06-25 10:52, David Mazieres wrote: Further confusing things, GHC accepts the following: g1 x y z = if xy then show x ++ show z else g2 y x g2 :: (Show a, Ord a) = a - a - String g2 | False = \p q - g1 q p () | otherwise = \p q - g1 q p 'a'

Re: [Haskell-cafe] Help

2011-06-25 Thread Stoyan Peev
First I am using WinHugs. that's the code i made so far but it's still not working: http://hpaste.org/48318 Error: ERROR file:.\kursovazadacha.hs:36 - Type error in explicitly typed binding *** Term : p *** Type : [String] - [a] *** Does not match : [String] - Int I'm

Re: [Haskell-cafe] Help

2011-06-25 Thread Jack Henahan
The error in ghci is Couldn't match expected type `Int' with actual type `[a0]' In the expression: [] In an equation for `p': p [] = [] You've defined p as [String] - Int, but then your base case is p [] = []. [] is not an Int. I changed it to 0 and it'll compile, at least, but I'm not

[Haskell-cafe] ANNOUNCE: Win32-junction-point-0.0.1

2011-06-25 Thread Michael Steele
I'm pleased to announce the initial release of Win32-junction-point * hackage: http://hackage.haskell.org/package/Win32-junction-point * git repository: https://github.com/mikesteele81/Win32-junction-point This package provides the ability to manipulate NTFS junction points as supported by

Re: [Haskell-cafe] commutative monoid?

2011-06-25 Thread Henning Thielemann
On Fri, 24 Jun 2011, Evan Laforge wrote: So there's a range of possible Monoid instances for each type, and maybe they were chosen by historical happenstance rather than some kind of principle monoid (is there such a thing?). Is there a name for the thing that's like a monoid, but the

Re: [Haskell-cafe] commutative monoid?

2011-06-25 Thread Brent Yorgey
On Fri, Jun 24, 2011 at 11:13:46PM -0700, wren ng thornton wrote: On 6/25/11 1:34 AM, Evan Laforge wrote: So there's a range of possible Monoid instances for each type, More for some types than for others. For Maybe there are three: * always take the first/left value; * always take the

Re: [Haskell-cafe] Iteratee IO examples

2011-06-25 Thread wren ng thornton
On 6/25/11 6:51 AM, John Lato wrote: Honestly I'm quite dis-satisfied with the current state of code which depends on iteratee/enumerator. It's nearly all written in a very low-level style, i.e. directly writing 'liftI step', or 'case x of Yield - ...'. This is exactly what I would hope

Re: [Haskell-cafe] Map Monoid instance (was commutative monoid?)

2011-06-25 Thread wren ng thornton
On 6/25/11 12:00 PM, Jens Blanck wrote: So there's a range of possible Monoid instances for each type, More for some types than for others. For Maybe there are three: * always take the first/left value; * always take the last/right value; * or, use a semigroup operation defined on the

Re: [Haskell-cafe] Map Monoid instance (was commutative monoid?)

2011-06-25 Thread wren ng thornton
On 6/25/11 1:07 PM, Evan Laforge wrote: In the case of the overriding version, you have to decide on which side to merge the new monoid, and on the lifted one the two choices become four, since you then have to decide whether the unionWith argument should be flipped or not. [...] So I think

Re: [Haskell-cafe] commutative monoid?

2011-06-25 Thread Evan Laforge
On Sat, Jun 25, 2011 at 2:02 PM, Brent Yorgey byor...@seas.upenn.edu wrote: Actually, there are (at least) four: there's also the one where mappend = liftA2 mappend, i.e. introduce potential failure into a monoid operation defined on the values.  I wrote about it here:    

Re: [Haskell-cafe] Map Monoid instance (was commutative monoid?)

2011-06-25 Thread wren ng thornton
On 6/25/11 2:15 PM, Erik Hesselink wrote: On Sat, Jun 25, 2011 at 19:07, Evan Laforgeqdun...@gmail.com wrote: On Sat, Jun 25, 2011 at 9:00 AM, Jens Blanckjens.bla...@gmail.com wrote: So there's a range of possible Monoid instances for each type, More for some types than for others. For

Re: [Haskell-cafe] What is a simple pattern binding?

2011-06-25 Thread dm-list-haskell-cafe
At Sat, 25 Jun 2011 14:20:52 -0400, Scott Turner wrote: g1 x y z = if xy then show x ++ show z else g2 y x g2 :: (Show a, Ord a) = a - a - String g2 | False = \p q - g1 q p () | otherwise = \p q - g1 q p 'a' where x = True It appears to me that

Re: [Haskell-cafe] What is a simple pattern binding?

2011-06-25 Thread Paterson, Ross
g1 x y z = if xy then show x ++ show z else g2 y x g2 :: (Show a, Ord a) = a - a - String g2 | False = \p q - g1 q p () | otherwise = \p q - g1 q p 'a' where x = True It appears to me that GHC is justified. According to 4.5.1 and 4.5.2, g1

Re: [Haskell-cafe] Iteratee IO examples

2011-06-25 Thread John Lato
On Sat, Jun 25, 2011 at 10:18 PM, wren ng thornton w...@freegeek.orgwrote: On 6/25/11 6:51 AM, John Lato wrote: Honestly I'm quite dis-satisfied with the current state of code which depends on iteratee/enumerator. It's nearly all written in a very low-level style, i.e. directly writing

Re: [Haskell-cafe] What is a simple pattern binding?

2011-06-25 Thread dm-list-haskell-cafe
At Sun, 26 Jun 2011 00:17:12 +0100, Paterson, Ross wrote: g1 x y z = if xy then show x ++ show z else g2 y x g2 :: (Show a, Ord a) = a - a - String g2 | False = \p q - g1 q p () | otherwise = \p q - g1 q p 'a' where x = True It

Re: [Haskell-cafe] What is a simple pattern binding?

2011-06-25 Thread Paterson, Ross
I thought no type signature meant no type signature inside b1. No, it means no type signature for the variable. Otherwise, you are saying nothing could depend on a binding with a type signature. By that logic, there can be no mutual dependence, and so every declaration with a type signature

[Haskell-cafe] Data.Time

2011-06-25 Thread Tony Morris
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I recently set out to write a library that required a decent time library. Having only had a flirt with Data.Time previously, I assumed it would be robust like many other haskell libraries. I don't know about consensus, but I have been massively let

Re: [Haskell-cafe] Data.Time

2011-06-25 Thread joe
I've tended to use the attached module. It is basic, but has covered my needs. It probably has many issues (bugs, inefficiencies, naming conventions, etc) but has been sufficient so far. Developed by myself a few years ago, under no particular licence - happy for reuse or for someone to take it