Type of sample code

3 views
Skip to first unread message

Edward Z. Yang

unread,
Apr 12, 2010, 5:52:49 PM4/12/10
to haskell-charts
On the wiki, some suggested sample code is as such:

$ ghci -package Chart
...
Prelude> :m Graphics.Rendering.Chart.Simple
Prelude Graphics.Rendering.Chart.Simple> plotWindow [0,0.1..2.9] sin

However, I needed to explicitly cast the list into [Double], lest
I get an ambiguous type variable. Am I or the example wrong?

Cheers,
Edward

Tim Docker

unread,
Apr 12, 2010, 8:48:09 PM4/12/10
to Haskell Charts
This works as written for me with chart-0.13 on GHC 10.4. What
versions are you using?

Edward Z. Yang

unread,
Apr 12, 2010, 8:50:29 PM4/12/10
to Tim Docker, Haskell Charts
Excerpts from Tim Docker's message of Mon Apr 12 20:48:09 -0400 2010:

> This works as written for me with chart-0.13 on GHC 10.4. What
> versions are you using?

Hmm, it looks like it works if I do this in GHCI, but not if I stick it
in an HS file.

Cheers,
Edward

Malcolm Wallace

unread,
Apr 13, 2010, 2:51:10 AM4/13/10
to haskell...@googlegroups.com
> Hmm, it looks like it works if I do this in GHCI, but not if I stick
> it
> in an HS file.

You get automatic type-defaulting of ambiguous type variables in the
interactive environment, but not when you compile.

Regards,
Malcolm

Reply all
Reply to author
Forward
0 new messages