[Haskell-cafe] Existential quantification of config data types

Charlie Durham cpdurham at gmail.com
Tue Apr 19 00:10:33 UTC 2016


Yeah, I'm starting to think the ADT makes the most sense. With the
readLayer call though, how do you know which layer to read? Or are you
still stuck with the failing to parse a list of potentials and then taking
the one that doesnt fail?

Thanks,


Charlie

On Mon, Apr 18, 2016 at 7:45 PM, Sumit Sahrawat, Maths & Computing, IIT
(BHU) <sumit.sahrawat.apm13 at iitbhu.ac.in> wrote:

> You can create a readLayer function that returns something like this:
>
>    * data** OneLayer** =** forall** a. Layer a =>** OneLayer** a*
>
> Such that we get:
>
> *    -- Read next layer*
>     *readLayer** :: Handle -> IO* *OneLayer*
>
> Still, I feel that an ADT that combines all types is better as it fits the
> problem perfectly. Every time you add a new layer it will generate warnings
> for missing pattern matches.
>
> Regards,
>   Sumit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160418/fdfdd27b/attachment.html>


More information about the Haskell-Cafe mailing list