michael at schmong.org
Sat May 28 00:46:22 BST 2011
Henning, thanks for your continued help.
I'm having difficulty using the constructor histogram, with the data I
have and the histogram I want to create from it.
I made a very primitive mock-up of what I need, posted at the following url.
I won't have any x points, only y. Could you explain how I could use
the constructor you suggested?
The labeling on the x-axis is missing some info, but I'm thinking that
won't prevent a general solution to this problem.
On Thu, May 26, 2011 at 11:05 PM, Henning Thielemann
<lemming at henning-thielemann.de> wrote:
> On Thu, 26 May 2011, Michael Litchard wrote:
>> From what I understand, the following question is basic Haskell. I'm
>> not getting it and I hope I can get clarification here.
>> Let's start with newtype T.
>> newtype T x y a = Cons String
>> This looks like a partially applied type constructor. Is this right?
> In this definition everything is fully applied, both the type constructor T
> and the data constructor Cons. That the type parameters 'x', 'y', 'a' on the
> left hand side are not used on the right hand side, is called "phantom
>> Take for example
>> lines :: (Atom.C x, Atom.C y) => T x y (x,y)
>> compared with
>> histogram :: (Atom.C x) => Graph2DType.T Int Int (x,String)
>> The first thing that strikes me is while the variables in lines are
>> general ( x or y) the ones in histogram are not. This is where my
>> attempt falls apart.
> In (T x y a), the 'x' is the type of the values on the x axis, 'y' is the
> type of the values on the y axis and 'a' is the type of the plotted data. I
> thought that histogram data is discrete and thus chose Int as types for the
>> I'm referencing LYAH in an attempt to grasp this concept, and I feel I
>> should have already.
>> Could you explain the relationship between newtype T x y a = Cons
>> String and histogram :: (Atom.C x) => Graph2DType.T Int Int
> In the end 'lines' is just mapped to the word "lines" in the gnuplot script
> (curve.gp). But the 'lines' graph type of gnuplot requires a certain number
> and types of columns. This is what I express with the type "Graph2DType.T x
> y (x,y)". It means: X and Y axes may have different type, say Int and Float,
> and the actual data has two columns, one of the type of the X axis and one
> of the type of Y axis. (Atom.C x) restricts the choice of types to those
> that are supported by gnuplot in one column. That is, 'x' cannot be e.g.
> (Double,Double) or (IO String).
More information about the Gnuplot