[Haskell-beginners] Tagged types

Steven Leiva leiva.steven at gmail.com
Tue Oct 2 17:18:14 UTC 2018


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:

data Unchecked = Unchecked String
data Checked = Hd5 String | Cbf String

check :: Unchecked -> Checked

There is likely a better concept than "Checked" in your domain. I do not
know what those things represent, but I would use that *ubiquitous
language* instead
- i.e., data Image ... instead of Checked.



On Tue, Oct 2, 2018 at 12:05 PM PICCA Frederic-Emmanuel <
frederic-emmanuel.picca at synchrotron-soleil.fr> wrote:

> > I believe you can do this with GADTs [1]
>
> I can create different constructors for the different types.
> but how can I create a function which return different type ?
>
>
> Fred
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>


-- 
Steven Leiva
305.528.6038
leiva.steven at gmail.com
http://www.linkedin.com/in/stevenleiva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20181002/11ec17f6/attachment.html>


More information about the Beginners mailing list