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
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
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
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:
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
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
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
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
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
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:
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
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
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:
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!
14 matches
Mail list logo