<div dir="ltr">Works for me:<div><br></div><div><div>Prelude> data Vis a = Hidden a | Shown a</div><div><span style="line-height:1.5">Prelude> :t [Hidden "foo", Shown "bar"]</span><br></div><div>[Hidden "foo", Shown "bar"] :: [Vis [Char]]</div><div>Prelude> type VisListInt = [Vis Int]</div><div>Prelude> let foo = (id :: VisListInt -> VisListInt)</div><div><span style="line-height:1.5">Prelude> :t foo</span><br></div><div>foo :: VisListInt -> VisListInt</div><div><span style="line-height:1.5">Prelude> :t foo [Hidden 2]</span><br></div><div>foo [Hidden 2] :: VisListInt</div></div><div><br></div><div>What error message are you seeing?</div><div><br></div><div>Cheers,<br>Alex</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, 3 Nov 2015 at 14:24 Thomas Jakway <<a href="mailto:tjakway@nyu.edu">tjakway@nyu.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I've made a new datatype<br>
<br>
data Visibility a = Hidden a | Shown a<br>
<br>
I want to create a type that's a list of hidden and visible integers.<br>
So something like this:<br>
<br>
type possiblyVisibleInts = [Visibility Int]<br>
<br>
The idea is that some of the ints will be hidden and some will be shown.<br>
<br>
But it doesn't work. Why not?<br>
This seemed even odder to me after poking around in ghci:<br>
<br>
:t [Just 5, Nothing]<br>
gives<br>
[Just 5, Nothing] :: Num a => [Maybe a]<br>
<br>
So clearly it's possible to have a list of a type that has 2<br>
constructors--you're not restricted to having a list that only contains<br>
Just, for example.<br>
<br>
ghci is also OK with e.g.<br>
<br>
:t [Hidden 5, Shown 6]<br>
[Hidden 5, Shown 6] :: Num a => [Visibility a]<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>