<div dir="ltr">Unfortunately I do not know the fancy Haskell type-level stuff, but if I was looking at this same problem, I'd think you need a sum type:<div><br></div><div>data Unchecked = Unchecked String</div><div>data Checked = Hd5 String | Cbf String</div><div><br></div><div>check :: Unchecked -> Checked</div><div><br></div><div>There is likely a better concept than "Checked" in your domain. I do not know what those things represent, but I would use that <b>ubiquitous language</b> instead - i.e., data Image ... instead of Checked. </div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Oct 2, 2018 at 12:05 PM PICCA Frederic-Emmanuel <<a href="mailto:frederic-emmanuel.picca@synchrotron-soleil.fr">frederic-emmanuel.picca@synchrotron-soleil.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> I believe you can do this with GADTs [1]<br>
<br>
I can create different constructors for the different types.<br>
but how can I create a function which return different type ?<br>
<br>
<br>
Fred<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><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Steven Leiva<br>305.528.6038<br><a href="mailto:leiva.steven@gmail.com" target="_blank">leiva.steven@gmail.com</a><br><a href="http://www.linkedin.com/in/stevenleiva" target="_blank">http://www.linkedin.com/in/stevenleiva</a><br></div>