Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Re: DataKinds and GADTs question? (c...@coot.me) ---------------------------------------------------------------------- Message: 1 Date: Sat, 12 Jun 2021 11:13:01 +0000 From: c...@coot.me To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] DataKinds and GADTs question? Message-ID: <WCVdiFMzZCPwzMoRiCQFWKAvs1YldwXZ1yay-shqB3irFEDOTqYfPF6izJ_WvruhtUxypjj5uD4zq-d-iZNGrAJ1HACVrCweFZiWJD88g0c=@coot.me> Content-Type: text/plain; charset="utf-8" There isn't. GHC will infer kind `Type -> Type` for `MyType2`. You can check that in `ghci` with `:kind MyType` and `:kind MyType2`. There's also third way to write it by adding a standalone kind signature: ``` {-# LANGUAGE StandalondKindSignatures, GADTs #-} type MyType3 :: Type -> Type data MyType3 a where MkT3 :: Int -> MyType3 Int ``` A polykinded version would look like this: ``` {-# LANGUAGE PolyKinds #-} type MyType4 :: forall a -> Type data MyType4 a where MkT3 :: MyType4 Int ``` in `ghci` the kind of `MyType4` is: ``` :kind MyType4 MyType4 :: forall k. forall (a :: k) -> Type ``` Best regards, Marcin Sent with ProtonMail Secure Email. ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Thursday, June 10th, 2021 at 13:15, Velichko Lefterov <velichko.lefte...@gmail.com> wrote: > I tried to understand DataKinds and GADTs...Is there a difference between: > > data MyType :: Type -> Type where > > MyTypeConstructor :: Int -> MyType Int > > data MyType2 a where > > MyTypeConstructor2 :: Int -> MyType2 Int -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20210612/cca51f6f/attachment-0001.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 509 bytes Desc: OpenPGP digital signature URL: <http://mail.haskell.org/pipermail/beginners/attachments/20210612/cca51f6f/attachment-0001.sig> ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 155, Issue 7 *****************************************