[Haskell-beginners] Tagged types
PICCA Frederic-Emmanuel
frederic-emmanuel.picca at synchrotron-soleil.fr
Tue Oct 2 16:48:09 UTC 2018
Hello
suppose that I have a bunch of type like this
data Unchecked
data Hdf5
data Cbf
data A t > A String
The A thing come from a database as A Unchecked
now if I read the String and it ends with .h5, I have a A Hdf5 type
and If the string end with .cbf, I have a A Cbf.
So I would like a function which allow to return a A Hdf5 or a A Cbf depending on the String content.
check :: A Unchecked -> A ???
check = ???
Is it possible to do this ?
Thanks
Frederic
PS: At the end I will have more tha one tag.
More information about the Beginners
mailing list