
You need to have some sort of either type. check :: A Unchecked -> Either (A Hdf5) (A Cbf) But you'll have to deal with the fact that it could be either of those things throughout the rest of your program, somehow. Another way would be to have data CheckedType = Hdf5 | Cbf check :: A Unchecked -> A CheckedType But this has the same downside. There may be some way with the singletons library, but I think that is out of the scope of the newbies list. On Tue, Oct 2, 2018 at 1:04 PM PICCA Frederic-Emmanuel < frederic-emmanuel.picca@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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners