Send Beginners mailing list submissions to
[email protected]
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
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: Install bullet-0.2.2 failure in OS X 10.8.2
(Trung Quang Nguyen)
2. Re: Install bullet-0.2.2 failure in OS X 10.8.2 (Daniel Fischer)
3. Illegal datatype context when modelling round robin
scheduler (Xiao Jia)
4. Re: Illegal datatype context when modelling round robin
scheduler (Jonathan Rioux)
5. Re: Illegal datatype context when modelling round robin
scheduler (Jonathan Rioux)
----------------------------------------------------------------------
Message: 1
Date: Thu, 6 Dec 2012 12:51:55 +0100
From: Trung Quang Nguyen <[email protected]>
Subject: Re: [Haskell-beginners] Install bullet-0.2.2 failure in OS X
10.8.2
To: Krzysztof Skrz?tnicki <[email protected]>
Cc: beginners <[email protected]>
Message-ID:
<cals5uby3f38qp6jumprvtay2a-30cghdd38urecboe0hebb...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi there,
After installing c2hs, and run cabal install bullet. I got this error. Did
I miss any step?
Resolving dependencies...
Configuring bullet-0.2.2...
Building bullet-0.2.2...
Preprocessing library bullet-0.2.2...
[ 1 of 17] Compiling Physics.Bullet.Raw.Types (
Physics/Bullet/Raw/Types.hs, dist/build/Physics/Bullet/Raw/Types.o )
[ 2 of 17] Compiling Physics.Bullet.Raw.C2HS ( Physics/Bullet/Raw/C2HS.hs,
dist/build/Physics/Bullet/Raw/C2HS.o )
Physics/Bullet/Raw/C2HS.hs:211:12:
Could not deduce (Eq a) arising from a use of `toBool'
from the context (Num a)
bound by the type signature for cToBool :: Num a => a -> Bool
at Physics/Bullet/Raw/C2HS.hs:211:1-17
Possible fix:
add (Eq a) to the context of
the type signature for cToBool :: Num a => a -> Bool
In the expression: toBool
In an equation for `cToBool': cToBool = toBool
Failed to install bullet-0.2.2
cabal: Error: some packages failed to install:
bullet-0.2.2 failed during the building phase. The exception was:
ExitFailure 1
Best regards,
Trung
2012/12/6 Krzysztof Skrz?tnicki <[email protected]>
> The line:
>
> > cabal: The program c2hs is required but it could not be found.
> is pretty clear about the source of error. You have to install c2hs first
> and make sure its in PATH. Use either some packaged version of c2hs or
> "cabal install c2hs".
>
> Best regards,
> Krzysztof Skrz?tnicki
>
>
> On Thu, Dec 6, 2012 at 11:48 AM, Trung Quang Nguyen
> <[email protected]>wrote:
>
>> The program c2hs is required but it could not be found.
>
>
>
--
*Trung Nguyen*
Mobile: +45 50 11 10 63
LinkedIn: http://www.linkedin.com/pub/trung-nguyen/36/a44/187
View my blog at http://www.onextrabit.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20121206/2aebd4a2/attachment-0001.htm>
------------------------------
Message: 2
Date: Thu, 06 Dec 2012 13:44:56 +0100
From: Daniel Fischer <[email protected]>
Subject: Re: [Haskell-beginners] Install bullet-0.2.2 failure in OS X
10.8.2
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
On Donnerstag, 6. Dezember 2012, 12:51:55, Trung Quang Nguyen wrote:
> Hi there,
>
> After installing c2hs, and run cabal install bullet. I got this error. Did
> I miss any step?
No, the maintainer of bullet just has not updated the package to incorporate
the changes in base-4.6.
>
> Physics/Bullet/Raw/C2HS.hs:211:12:
> Could not deduce (Eq a) arising from a use of `toBool'
> from the context (Num a)
> bound by the type signature for cToBool :: Num a => a -> Bool
> at Physics/Bullet/Raw/C2HS.hs:211:1-17
> Possible fix:
> add (Eq a) to the context of
> the type signature for cToBool :: Num a => a -> Bool
> In the expression: toBool
> In an equation for `cToBool': cToBool = toBool
Formerly, Eq and Show were superclasses of Num (
class (Eq a, Show a) => Num a where...
) but they have been removed recently (they prevented some reasonable Num
instances unless you mad dummy Eq and Show instances,
instance Num a => Num (e -> a)
for example).
So before base-4.6, a Num constraint implied Eq, that is no longer so.
Quick fix:
$ cabal unpack bullet
- cd bullet-0.2.2
- edit the .cabal file, bumping the version to 0.2.2.1 or so
- edit the sources adding Eq or Show constraints where necessary (you have
seen one spot, cabal configure and after that cabal build would detect further
spots if there are any, cabal install too, but if you configure with
--disable-library-profiling --disable-shared, cabal build is quicker to find
the spots)
- cabal install
(no arguments, so it configures and installs the package from the directory)
Long-term fix: send a patch (or at least a bug report/feature request) to the
maintainer of bullet.
------------------------------
Message: 3
Date: Thu, 6 Dec 2012 22:24:35 +0800
From: Xiao Jia <[email protected]>
Subject: [Haskell-beginners] Illegal datatype context when modelling
round robin scheduler
To: [email protected]
Message-ID:
<cao0g3ihyazcx6axp8jg7v1js31jjtcbnezd3lmpmc7jmwkp...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Hi, I'm trying to model a round robin scheduler in Haskell.
> class Schedulable s where
> isFinal :: s -> Bool
>
> class Scheduler s where
> add :: (Schedulable a) => a -> s -> s
> next :: (Schedulable a) => s -> (a, s)
> empty :: s -> Bool
>
> data Schedulable a => RoundRobin = RoundRobin [a] [a]
>
> instance Scheduler RoundRobin where
> add p (RoundRobin ps qs) = RoundRobin (ps ++ [p]) qs
>
> next (RoundRobin [] qs) = next (RoundRobin qs [])
> next (RoundRobin (p:ps) qs) = (p, RoundRobin ps (qs ++ [p]))
>
> empty (RoundRobin [] _) = True
> empty _ = False
However, GHC complains that
> main.hs:9:6:
> Illegal datatype context (use -XDatatypeContexts): Schedulable a =>
After some searches I realized that datatype contexts are deprecated.
So how can I model the scheduler without using datatype contexts?
Thanks.
--
Regards,
Xiao Jia
------------------------------
Message: 4
Date: Thu, 6 Dec 2012 09:39:47 -0500
From: Jonathan Rioux <[email protected]>
Subject: Re: [Haskell-beginners] Illegal datatype context when
modelling round robin scheduler
To: Xiao Jia <[email protected]>
Cc: [email protected]
Message-ID:
<CAH3N84UVcZ2WhsBPFvqrOxf2aCtNSACj8A-zgr=ydz_jdte...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hello Xiao,
>From what I've read from this page (
http://hackage.haskell.org/trac/haskell-prime/wiki/NoDatatypeContexts ),
you simply need to remove ? Schedulable a ? from 9th line.
It would there fore read like so :
data Schedulable a => RoundRobin = RoundRobin [a] [a]
Putting ? Schedulable a) => ? in your ? add ? and ? next ? functions should
be sufficient.
Hope this helps,
Jon
On Thu, Dec 6, 2012 at 9:24 AM, Xiao Jia <[email protected]> wrote:
> Hi, I'm trying to model a round robin scheduler in Haskell.
>
> > class Schedulable s where
> > isFinal :: s -> Bool
> >
> > class Scheduler s where
> > add :: (Schedulable a) => a -> s -> s
> > next :: (Schedulable a) => s -> (a, s)
> > empty :: s -> Bool
> >
> > data Schedulable a => RoundRobin = RoundRobin [a] [a]
> >
> > instance Scheduler RoundRobin where
> > add p (RoundRobin ps qs) = RoundRobin (ps ++ [p]) qs
> >
> > next (RoundRobin [] qs) = next (RoundRobin qs [])
> > next (RoundRobin (p:ps) qs) = (p, RoundRobin ps (qs ++ [p]))
> >
> > empty (RoundRobin [] _) = True
> > empty _ = False
>
> However, GHC complains that
>
> > main.hs:9:6:
> > Illegal datatype context (use -XDatatypeContexts): Schedulable a =>
>
> After some searches I realized that datatype contexts are deprecated.
> So how can I model the scheduler without using datatype contexts?
>
> Thanks.
>
> --
> Regards,
> Xiao Jia
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20121206/b1726d33/attachment.htm>
------------------------------
Message: 5
Date: Thu, 6 Dec 2012 09:47:31 -0500
From: Jonathan Rioux <[email protected]>
Subject: Re: [Haskell-beginners] Illegal datatype context when
modelling round robin scheduler
To: beginners <[email protected]>
Message-ID:
<cah3n84x94gtetjk0wkq3scp8pksb5p06+9e31ggvy9qgqjx...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
On Thu, Dec 6, 2012 at 9:24 AM, Xiao Jia <[email protected]> wrote:
> Hi, I'm trying to model a round robin scheduler in Haskell.
>
> > class Schedulable s where
> > isFinal :: s -> Bool
> >
> > class Scheduler s where
> > add :: (Schedulable a) => a -> s -> s
> > next :: (Schedulable a) => s -> (a, s)
> > empty :: s -> Bool
> >
> > data Schedulable a => RoundRobin = RoundRobin [a] [a]
> >
> > instance Scheduler RoundRobin where
> > add p (RoundRobin ps qs) = RoundRobin (ps ++ [p]) qs
> >
> > next (RoundRobin [] qs) = next (RoundRobin qs [])
> > next (RoundRobin (p:ps) qs) = (p, RoundRobin ps (qs ++ [p]))
> >
> > empty (RoundRobin [] _) = True
> > empty _ = False
>
> However, GHC complains that
>
> > main.hs:9:6:
> > Illegal datatype context (use -XDatatypeContexts): Schedulable a =>
>
> After some searches I realized that datatype contexts are deprecated.
> So how can I model the scheduler without using datatype contexts?
>
> Thanks.
>
> --
> Regards,
> Xiao Jia
>
>
Hello Xiao,
>From what I've read from this page (
http://hackage.haskell.org/trac/haskell-prime/wiki/NoDatatypeContexts ),
you simply need to remove ? Schedulable a ? from 9th line.
It would there fore read like so :
data Schedulable a => RoundRobin = RoundRobin [a] [a]
Putting ? Schedulable a) => ? in your ? add ? and ? next ? functions should
be sufficient.
Hope this helps,
Jon
(Sorry for the double post, but I think I did something wrong on the first
one...)
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20121206/95feca27/attachment.htm>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 54, Issue 9
****************************************