[GHC] #8177: Roles for type families
GHC
ghc-devs at haskell.org
Thu Sep 11 20:55:48 UTC 2014
#8177: Roles for type families
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: goldfire
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.3
Resolution: | Keywords:
Operating System: | Architecture: Unknown/Multiple
Unknown/Multiple | Difficulty: Unknown
Type of failure: | Blocked By:
None/Unknown | Related Tickets:
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by dmcclean):
Hmmm.
I was concerned there for a second, because actually `Quantity'` won't be
in scope for my users. Its not exported from the module because you can
use it to do nefarious things.
So I thought that my test in GHCi had been insufficiently thorough,
because GHCi doesn't respect the export list and lets you get at
unexported things for convenience.
So I made a new module to try it.
{{{
import Numeric.Units.Dimensional.DK.Prelude
import Data.Coerce
main = do
let x = 3.7 :: Double
let y = (coerce x) :: Mass Double
putStrLn . show $ y
-- putStrLn . show $ Quantity' x -- doesn't compile with this
line here
}}}
It works just fine and prints "3.7 m". With the commented line it doesn't
compile, complaining that `Quantity'` is (as I intended) not in scope. (If
it had been in scope, it would still fail because the dimension is
ambiguous, but that's not the point.)
So it seems that whether or not the newtype constructor is in scope is not
the determining factor here. If it was intended to be, than this may be a
bug?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8177#comment:22>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list