I have defined a data type like this for representing a 2D point:
data Point = Point (Double, Double) deriving (Show)
And a data type Curve (curve is a list of points in 2D space that create a curve
data Curve = Curve [Point] deriving (Show)
How can I set the Curve datatype to be nonempty? so that it always needs to have at least 1 Point in the list?
data Curve = Curve Point [Point]. Besides, for performance reasons, you could usenewtypeinstead ofdatato definePoint.Tand every class is namedC. In code, that's fine, because his style is to import everything qualified (so things look likeNonEmpty.TorRing.C), but haddock doesn't really deal with that style gracefully, resulting in type signatures that look like(C a, C b) => T a -> T b -> T -> Tand other such illegible nonsense.