Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  help with a class definition (Rustom Mody)
   2. Re:  help with a class definition (Daniel Fischer)
   3.  Multi-parameter type classes (David Beacham)
   4. Re:  Multi-parameter type classes (Stephen Tetley)
   5. Re:  Cabal on mac (Tim Pizey)


----------------------------------------------------------------------

Message: 1
Date: Mon, 28 Nov 2011 19:51:56 +0530
From: Rustom Mody <rustom.m...@parsci.com>
Subject: [Haskell-beginners] help with a class definition
To: Beginners Haskell <Beginners@haskell.org>
Message-ID:
        <CAG3g5nkHPScLk3rVHiPKNc5Bz+ZLcKY0Oy9id=gbj7mpxw3...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

The Data.Vector.Unboxed page on hackage has the following line

class (Vector Vector a, MVector MVector a) => Unbox a

Can someone explain whats the repeating Vector (and MVector) there?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20111128/26040ff1/attachment-0001.htm>

------------------------------

Message: 2
Date: Mon, 28 Nov 2011 16:01:27 +0100
From: Daniel Fischer <daniel.is.fisc...@googlemail.com>
Subject: Re: [Haskell-beginners] help with a class definition
To: beginners@haskell.org
Message-ID: <201111281601.28041.daniel.is.fisc...@googlemail.com>
Content-Type: Text/Plain;  charset="utf-8"

On Monday 28 November 2011, 15:21:56, Rustom Mody wrote:
> The Data.Vector.Unboxed page on hackage has the following line
> 
> class (Vector Vector a, MVector MVector a) => Unbox a
> 
> Can someone explain whats the repeating Vector (and MVector) there?

Vector and MVector both appear as the names of two different things here.

The first occurrence is as the name of the (two-parameter) class,

class [M]Vector v a where ...

and the second occurrence is as the name of a datatype constructor

data [M]Vector a = [M]Vector ...


In instance declarations, the name can also appear as the name of a third 
thing, the value constructor ;)



------------------------------

Message: 3
Date: Mon, 28 Nov 2011 19:35:11 +0000
From: David Beacham <dbeac...@dbeacham.co.uk>
Subject: [Haskell-beginners] Multi-parameter type classes
To: Beginners Haskell <Beginners@haskell.org>
Message-ID: <4ed3e26f.60...@dbeacham.co.uk>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi all,

I've been reading through Okasaki's purely functional data structures 
and noticed that the source he provides for the Set implementations uses 
multi-parameter type classes, whereas those for the Heap structures does 
not.

class Set s a where
   empty :: s a
   insert :: a -> s a -> s a
   ...

class Heap h where
   empty :: Ord a => h a
   insert :: Ord a => a -> h a -> h a
   ...

The only difference I can see is that the instance declarations for Set 
contain the Ord constraint, whereas they are defined on the class 
functions for Heap.

instance (Ord a) => Set RedBlackSet a where
    ...

I realise that the type of `a` needs to be constrained to Ord instances 
at some point in the code, but is there any particular reason for doing 
it differently in each case? If not, should one method be preferred over 
the other?

Thanks for the help, David.



------------------------------

Message: 4
Date: Mon, 28 Nov 2011 22:38:34 +0000
From: Stephen Tetley <stephen.tet...@gmail.com>
Subject: Re: [Haskell-beginners] Multi-parameter type classes
To: David Beacham <dbeac...@dbeacham.co.uk>
Cc: Beginners Haskell <Beginners@haskell.org>
Message-ID:
        <CAB2TPRBR7b6KmProLJ1pvWs=z5naza3mjfig0jj7jeq+q7p...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Maybe some instances of Sets can be built with just equality (Eq)
rather than Ordering (Ord) on the element?

The multi-param class makes the element type tangible so you can use a
different constraint:

-- List - the poor man's set.
instance (Eq a) => Set [] a where
  empty = []
  insert a as = nub (a:as)
  ...



------------------------------

Message: 5
Date: Mon, 28 Nov 2011 23:32:51 +0000
From: Tim Pizey <t...@paneris.org>
Subject: Re: [Haskell-beginners] Cabal on mac
To: Daniel Fischer <daniel.is.fisc...@googlemail.com>
Cc: beginners@haskell.org
Message-ID:
        <caardntionkdd5aecb1abcwkndj4ratpohh-wyxfj0kzhwlq...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Hi Daniel,

Thanks for your reply:

On 25 November 2011 00:48, Daniel Fischer  wrote:
> On Friday 25 November 2011, 01:32:13, Tim Pizey wrote:
>> Hi,
>>
>> I have installed cabal and HaxMl
>>
>> cabal install HaXml
>>
>> but my .hs file cannot find
>>
>> import Text.XML.HaXml.Xml2Haskell (readXml)
>>
>> giving
>>
>> *** Chasing dependencies:
>> Chasing modules from: *ch.hs
>>
>> ch.hs:3:8:
>> ? ? Could not find module `Text.XML.HaXml.Xml2Haskell':
>> ? ? ? locations searched:
>> ? ? ? ? Text/XML/HaXml/Xml2Haskell.hs
>> ? ? ? ? Text/XML/HaXml/Xml2Haskell.lhs
>>
>> It would seem only to be looking in the current directory.
>>
>> Hoping I have just missed something obvious.
>
> In a way.
>
> Text.XML.HaXml.Xml2Haskell was in HaXml-1.13, but is no longer in HaXml
> since version 1.19 (current is 1.22.5). Old tutorial, I guess.
>
> There are two functions with the name readXml in the new versions, in
> Text.XML.HaXml.XmlContent and Text.XML.HaXml.XmlContent.Haskell
> (probably the same function, just exported from both modules).
>
> The type has changed, instead of XmlContent a => String -> Maybe a, it is
> now XmlContent a => String -> Either String a, presumably specifying the
> parse failure now if there is one, otherwise I expect the behaviour to be
> the same.

I am trying to use XsdToHaskell but am getting stuck.

The page http://projects.haskell.org/HaXml/
has dead links for DtdToHaskell and XsdToHaskell

There is an apparently dead project at http://code.google.com/p/xsdtohaskell/

I have a set of .xsd file which reference each other and the command

XsdToHaskell chassis.xsd > Chassis.xsd.hs

generates a lot of haskell, but seems to include debugging eg

Parse Success!

Do you or others know of some uptodate documentation?

cheers
Tim

-- 
Tim Pizey
http://pizey.net/~timp



------------------------------

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 41, Issue 40
*****************************************

Reply via email to