I had not!

I'm not seeing how such a solution would work. The nodes in a graph all have to have the same type. If the phantom parameter distinguished two nodes, they could not be used together.

But maybe you see something there that I don't?

On Thu, Feb 18, 2016 at 8:36 PM, Francesco Ariis <fa-ml@ariis.it> wrote:
On Thu, Feb 18, 2016 at 06:50:26PM -0800, Jeffrey Brown wrote:
> Suppose then you wanted to write a function that, given a person, returns
> the names of all their hamsters. To make sure the call makes sense, the
> function would have to first check that the input is in fact a person.
> Since persons and hamsters are both constructors of the same type, you
> can't let Haskell's robust, beautiful type-checking system distinguish them
> for you; you've got to write something like "case n of Person _ -> True; _
> -> False".
>
> Is there some way around writing such manual checks?

Hello Jeffrey,
    have you considered using Phantom types [1]?

[1] https://wiki.haskell.org/Phantom_type#Simple_examples
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe



--
Jeffrey Benjamin Brown