Re: Runtime selection on types while capturing a dictionary?

Andreas Källberg <[email protected]>
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <[email protected]>
> 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)
_______________________________________________
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.