
| foo x :: AppendsCallStack => a -> a Remove the "x"! S | -----Original Message----- | From: ghc-devs [mailto:ghc-devs-bounces@haskell.org] On Behalf Of | Joachim Breitner | Sent: 20 January 2016 09:08 | To: ghc-devs@haskell.org | Subject: Re: CallStack naming | | Hi, | | Am Mittwoch, den 20.01.2016, 00:39 -0500 schrieb Richard Eisenberg: | > I'm sure there's an easy answer to this, but I'm wondering: why is | the | > CallStack feature implemented with implicit parameters instead of | just | > a magical constraint? Whenever I use this feature, I don't want to | > have to enable -XImplicitParams and then make sure I get the name | > right. What would be wrong with, e.g., | > | > > undefined :: AppendsCallStack => a | > | > Seems simpler. Is it problems with a nullary class? | | I tried to construct this using what we have right now: | | ==> AppendCallStack.hs <== | {-# LANGUAGE ConstraintKinds, ImplicitParams #-} module | AppendCallStack (AppendsCallStack) where | | import GHC.Stack | | type AppendsCallStack = ?x::CallStack | | ==> Bar.hs <== | module Bar where | | import AppendCallStack | | foo x :: AppendsCallStack => a -> a | foo x = error "Test" | | But with GHC-7.10 I get | | [1 of 2] Compiling AppendCallStack ( AppendCallStack.hs, | AppendCallStack.o ) | [2 of 2] Compiling Bar ( Bar.hs, Bar.o ) | Bar.hs:5:1: | Invalid type signature: foo x :: AppendsCallStack => a -> a | Should be of form <variable> :: <type> | | although the constraint seems to be a constraint all right: | | *AppendCallStack> :kind AppendsCallStack | AppendsCallStack :: GHC.Prim.Constraint | | and with GHC HEAD I get | | [1 of 2] Compiling AppendCallStack ( AppendCallStack.hs, | AppendCallStack.o ) | | AppendCallStack.hs:6:1: error: | • Illegal implicit parameter ‘?x::CallStack’ | • In the type synonym declaration for ‘AppendsCallStack’ | | Too bad... | | Greetings, | Joachim | | -- | Joachim “nomeata” Breitner | mail@joachim-breitner.de • | https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fwww.jo | achim- | breitner.de%2f&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com%7cd5d44 | 2348f364bcc8a0108d321792a7c%7c72f988bf86f141af91ab2d7cd011db47%7c1&sda | ta=5KAXu5980%2bc4CchVNfWyo1mlD6D8%2bQKn9Qjp6ypv0eE%3d | Jabber: nomeata@joachim-breitner.de • GPG-Key: 0xF0FBF51F | Debian Developer: nomeata@debian.org