
1 Sep
2017
1 Sep
'17
10:55 a.m.
On Fri, Sep 01, 2017 at 05:18:02PM +0300, Baa wrote:
Hello, List!
For example, I have specialized (right nameis phantom?) type:
data Day a = Day { ... no `a` here } data Sunny data Rainy
joyToday :: Day Sunny -> IO () joyToday day = ...
melancholyToday :: Day Rainy -> IO () melancholyToday day = ...
And I can create (in spite of that it's phantom) some day:
let day1 = Day {...} :: Day Sunny joyToday day1
Hello Paul, the usual way is create a module and export `smart` constructors: module MyType (rainy, Day, Sunny) -- *not* Day rainy :: Day Rainy rainy = undefined -- something here That way you can use Day for time signatures but *not* `Day` the constructor. Does this solve your problem?