Re: type level function with different return kinds
Tom Ellis <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.cafe |
|---|---|
| Message-ID | <Z/Km1TJOl+A2vca5@cloudinit-builder> |
On Sun, Apr 06, 2025 at 12:27:04AM +0200, Zoran Bošnjak wrote:
> is it possible to write a type/kind level function that returns types of
> different kinds for different inputs. Either by using open/closed type
> families, a typeclass, extensions or any other type level magic.
The way you do this at the type level is with Dynamic:
https://www.stackage.org/haddock/lts-23.17/base-4.19.2.0/Data-Dynamic.html#t:Dynamic
Or equivalently, something like
data SomeTypeable where
MkSomeTypeable :: Typeable a => a -> SomeTypeable
So if you can work out how to promote one of those to the kind level
then yes. If not then probably no!
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.