Re: [Haskell-cafe] Partially applied type synonyms in instance heads

2006-10-29 Thread Nicolas Frisby
Haskell's type system does not directly allow eta expansion, i.e. instance Map (\x y - [(x, y)]) a b where ... is not legal. The straight-forward way to tackle this is with a newtype declaration, i.e. newtype Assoc a b = Assoc [(a, b)] instance Map Assoc a b where ... works as

Re: [Haskell-cafe] mapAccumL - find max in-sequence subsequence

2006-10-29 Thread jim burton
Sebastian Sylvan-2 wrote: I'm not sure I completely understand what you want, and if it needs to be cute (i.e. some clever one liner usage of a library function). But here's my get-the-job-done-solution (assuming I understood what you want): import Data.List import Data.Ord

Re: [Haskell-cafe] The Read Class

2006-10-29 Thread Tiago Veloso
Yes pleaseI wold like some examples (no importance how interesting) Maybe i can work my way from there.On 28 Oct 2006, at 23:32, Daniel Fischer wrote:Hi,probably the best way is to write a parser using ReadP/ReadPrec and theninstance Read SomeType where readPrec = yourParserIf you wish, I could

[Haskell-cafe] Re: Rank N type tutorial?

2006-10-29 Thread Jón Fairbairn
David House [EMAIL PROTECTED] writes: On 27/10/06, Greg Buchholz [EMAIL PROTECTED] wrote: I thought exists was spelled forall in Haskell? There is some confusion here, It's the notation for data declarations that causes the confusion. To rearrange your text a bit: So, for example:

[Haskell-cafe] YAHT: Ex 9.2

2006-10-29 Thread Magnus Therning
I've been slowly making my way through Yet Another Haskell Tutorial. As a first introduction to the language it doesn't seem bad at all. However, I'm wondering about the proposed solution to exercise 9.2. The text itself suggests using instance Monad (Either String) where, so I arrived at

Re: [Haskell-cafe] YAHT: Ex 9.2

2006-10-29 Thread Nicolas Frisby
Quick fix: add this line to the top of your file {-# OPTIONS -fglasgow-exts #-} Having String instead of a free type variable is beyond the basic limitations of Haskell's type classses. However, enabling the very common Glasgow extensions expands the rules to admit your definition. If you for

[Haskell-cafe] Deriving class instances using DrIFT

2006-10-29 Thread Daniel McAllansmith
Hi. I'm trying to derive some instances using DrIFT, but it will only work for me when I'm deriving for types in the current file or in the prelude. For example, this works: module Test where {-! for Maybe derive : Haskell2Xml !-} this works: module Test where data Foo = Foo {-! for Foo

[Haskell-cafe] More documentation: how to create a Haskell project

2006-10-29 Thread Donald Bruce Stewart
There's been a bit of discussion on irc, lists and privately about about documenting publically the best practice for creating a new Haskell project -- be that a library or an application. Some advice is now available here: http://haskell.org/haskellwiki/How_to_write_a_Haskell_program

Re: [Haskell-cafe] More documentation: how to create a Haskell project

2006-10-29 Thread Tony Morris
Tony Morris http://tmorris.net/ Donald Bruce Stewart wrote: There's been a bit of discussion on irc, lists and privately about about documenting publically the best practice for creating a new Haskell project -- be that a library or an application. Agreed. Some advice is now available

[Haskell-cafe] Documenting subcommunities

2006-10-29 Thread Donald Bruce Stewart
As the Haskell community grows and spreads its lambda-tipped tentacles into new domains, I've noticed that some distinct sub-communities are emerging. To try to document and collect information relevant to these groups, some new wiki pages have been created. Alongside the 'traditional' areas of:

Re: [Haskell-cafe] Deriving class instances using DrIFT

2006-10-29 Thread John Meacham
On Mon, Oct 30, 2006 at 01:24:58PM +1300, Daniel McAllansmith wrote: I'm trying to derive some instances using DrIFT, but it will only work for me when I'm deriving for types in the current file or in the prelude. Since DrIFT can only understand haskell source code, it can't derive instances

[Haskell-cafe] Re: function types as instances of Num

2006-10-29 Thread oleg
The problem seems equivalent to the following: http://pobox.com/~oleg/ftp/Haskell/typecast.html#local-fd That is, the inferred type is too general to chose the appropriate instance. The solution is also the same: either add type annotations to restrict the inferred type (and so make it

[Haskell-cafe] More documentation: languages written in Haskell

2006-10-29 Thread Donald Bruce Stewart
I noticed today that although we have a list of most applications written in Haskell, nowhere was there collected a page of perhaps our best use case for Haskell: for implementing compilers and interpreters! So here's a new 'libraries and tools' category page:

[Haskell-cafe] Re: More documentation: languages written in Haskell

2006-10-29 Thread Max Vasin
Donald == Donald Bruce Stewart [EMAIL PROTECTED] writes: Donald I noticed today that although we have a list of most Donald applications written in Haskell, nowhere was there Donald collected a page of perhaps our best use case for Haskell: Donald for implementing compilers and interpreters!