[Haskell-cafe] Runtime selection on types while capturing a dictionary?
Andreas Källberg
anka.213 at gmail.com
Wed Oct 9 07:33:30 UTC 2024
> On 8 Oct 2024, at 00:14, Tom Ellis <tom-lists-haskell-cafe-2023 at jaguarpaw.co.uk> 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)
More information about the Haskell-Cafe
mailing list