Confused about specified type variables using -XTypeApplications
Simon Peyton Jones
simonpj at microsoft.com
Thu Jan 7 22:32:02 UTC 2016
Make a ticket? This would be worth capturing.
I'm sure Richard will want to look at it when he gets back, and a ticket is a useful workflow organiser.
Simon
| -----Original Message-----
| From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Ryan Scott
| Sent: 07 January 2016 17:55
| To: GHC developers <ghc-devs at haskell.org>
| Subject: Confused about specified type variables using -XTypeApplications
|
| I read in the Visible Type Applications paper [1] that you can only
| apply types to "specified" type variables. However, after trying out
| -XTypeApplications, I'm confused as to what exactly that means:
|
| $ /opt/ghc/head/bin/ghci
| GHCi, version 8.1.20160106:
| https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fwww.haskell.o
| rg%2fghc%2f&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com%7caa1fba8c2743424
| c1fb008d3178bb622%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=2B1fES1XwoQb8T
| MRj7oOkfdfoGo37oXhjnHFeqgOXAI%3d :? for help
| λ> :set -XTypeInType -XTypeApplications
| λ> data Prox a = Prox
| λ> let prox :: Prox a; prox = Prox
| λ> :t prox @Int
| prox @Int :: Prox Int
| λ> :t Prox @Int
| Prox @Int :: Prox a
|
| Huh? For some reason, I'm getting different types for prox @Int and
| Prox @Int! I think what's happening here is that in Prox @Int, the Int
| is being applied to a kind variable. That is, it's being applied to
| the k variable in:
|
| Prox :: forall k (t :: k). Prox t
|
| But why is this? After all, I don't think I "specified" k anywhere in
| the definition of Prox, and to make things more confusing, Int gets
| applied differently in prox @Int (and the definition of prox also
| doesn't mention k). Is this a bug, or am I misunderstanding something
| about -XTypeApplications?
|
| Ryan S.
| -----
| [1]
| https://na01.safelinks.protection.outlook.com/?url=http:%2f%2fwww.cis.upenn.e
| du%2f~eir%2fpapers%2f2016%2ftype-app%2fvisible-type-
| app.pdf&data=01%7C01%7Csimonpj%40064d.mgd.microsoft.com%7Caa1fba8c2743424c1fb
| 008d3178bb622%7C72f988bf86f141af91ab2d7cd011db47%7C1&sdata=PKUXsuMdixF76cVq0y
| yaCW8NZbIO5hOJpXwABfUkYZw%3d
| _______________________________________________
| ghc-devs mailing list
| ghc-devs at haskell.org
| https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fmail.haskell.
| org%2fcgi-bin%2fmailman%2flistinfo%2fghc-
| devs%0a&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com%7caa1fba8c2743424c1fb
| 008d3178bb622%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=hV%2f3yHwiH36Qgegu
| hepSlx7JaZP0evwpGTTdK%2f3I3Po%3d
More information about the ghc-devs
mailing list