Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Haskell-beginners] how to install "import Foreign.C.Types( CFloat )" in Ubuntu

5 views
Skip to first unread message

Zsolt Ero

unread,
Nov 24, 2009, 2:12:01 AM11/24/09
to begi...@haskell.org
I am trying to run a file, which works well on the university system,
but I don't know what do I need to do to make it work on my home
Ubuntu system.

The particular line which makes the error is:
import Foreign.C.Types( CFloat )

And the error is:
-----------------------------------------------------------
LSystem.hs:130:4:
No instance for (ColorComponent CFloat)
arising from a use of `color' at LSystem.hs:130:4-26
Possible fix:
add an instance declaration for (ColorComponent CFloat)
.....
-------------------------------------------------------------

If I write "import Foreign.C.Types" at the Prelude it says nothing. If
I write "import Foreign.C.Types( CFloat )" at the Prelude, it says
<interactive>:1:0: parse error on input `import'

What can it be?

Cheers,
Zsolt
_______________________________________________
Beginners mailing list
Begi...@haskell.org
http://www.haskell.org/mailman/listinfo/beginners

Daniel Fischer

unread,
Nov 24, 2009, 9:02:14 AM11/24/09
to begi...@haskell.org
Am Dienstag 24 November 2009 08:11:25 schrieb Zsolt Ero:
> I am trying to run a file, which works well on the university system,
> but I don't know what do I need to do to make it work on my home
> Ubuntu system.
>
> The particular line which makes the error is:
> import Foreign.C.Types( CFloat )
>
> And the error is:
> -----------------------------------------------------------
> LSystem.hs:130:4:
> No instance for (ColorComponent CFloat)
> arising from a use of `color' at LSystem.hs:130:4-26
> Possible fix:
> add an instance declaration for (ColorComponent CFloat)
> .....
> -------------------------------------------------------------

The problem is not Foreign.C.Types, it's in your OpenGL lib.
Probably different versions at home and university.
Try adding

instance ColorComponent CFloat

to LSystem.hs

If that doesn't work, replacing (color x) with (color $ realToFrac x) in all pertinent
places should make it work.

>
> If I write "import Foreign.C.Types" at the Prelude it says nothing. If
> I write "import Foreign.C.Types( CFloat )" at the Prelude, it says
> <interactive>:1:0: parse error on input `import'

Yes, the import at the ghci-prompt is restricted, you can only do
import Module
there, no import lists, no hiding, no import qualified M as P.

0 new messages