Re: Runtime selection on types while capturing a dictionary?

Tom Ellis <[email protected]>
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <ZwYzc0aZ/g2tSaUH@cloudinit-builder>
On Wed, Oct 09, 2024 at 09:33:30AM +0200, Andreas Källberg wrote:
> 
> > On 8 Oct 2024, at 00:14, Tom Ellis <[email protected]> wrote:
> >    data PossiblyRootedTree lengths labels where
> >        RootedTree :: AugmentedTree [NodeId] lengths labels
> >        UnrootedTree :: AugmentedTree () lengths labels
> 
> Isn’t that invalid syntax? Wouldn’t you need either
> 
> data PossiblyRootedTree lengths labels where
>        RootedTree :: AugmentedTree [NodeId] lengths labels -> PossiblyRootedTree lengths labels 
>        UnrootedTree :: AugmentedTree () lengths labels  -> PossiblyRootedTree lengths labels
> 
> or simply (avoiding GADT syntax altogether):
> 
> data PossiblyRootedTree lengths labels =
>        RootedTree (AugmentedTree [NodeId] lengths labels)
>        | UnrootedTree (AugmentedTree () lengths labels)

Yes, you're right, thanks (and I'm not sure why I thought that
required a GADT).

Tom
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.