[Haskell-cafe] Can't use libraries in haskell

2011-06-25 Thread Александр
Hello, I'm new in haskell. I want to use xml library (http://hackage.haskell.org/package/xml) in my project. I downloaded it.then try to build and install: runhaskell Setup.hs configure runhaskell Setup.hs build runhaskell Setup.hs install All ok. There are no errors. When i try import mod

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

2011-06-25 Thread dm-list-haskell-cafe
At Sun, 26 Jun 2011 01:41:01 +0100, Paterson, Ross wrote: > > > 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

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

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

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 sign

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 x>y 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] Iteratee IO examples

2011-06-25 Thread John Lato
On Sat, Jun 25, 2011 at 10:18 PM, wren ng thornton wrote: > 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

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

2011-06-25 Thread Paterson, Ross
> > > g1 x y z = if x>y 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. Accordin

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 x>y 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 a

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 Laforge wrote: >> On Sat, Jun 25, 2011 at 9:00 AM, 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:

Re: [Haskell-cafe] commutative monoid?

2011-06-25 Thread Evan Laforge
On Sat, Jun 25, 2011 at 2:02 PM, Brent Yorgey 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: > >    http://byorgey.wordpress.com/2011/04/1

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

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

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

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 operat

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

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

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 st

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 x>y 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] Map Monoid instance (was commutative monoid?)

2011-06-25 Thread Erik Hesselink
On Sat, Jun 25, 2011 at 19:07, Evan Laforge wrote: > On Sat, Jun 25, 2011 at 9:00 AM, 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; >>>  *

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 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 for each type, >> >

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

2011-06-25 Thread Anton Nikishaev
Arlen Cuss 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 OPERATOR

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 introduc

[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

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

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 parti

Re: [Haskell-cafe] Iteratee IO examples

2011-06-25 Thread John Lato
From: Eric Rasmussen > > 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 be missing the p

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