[GHC] #11352: Allow applying type to label
GHC
ghc-devs at haskell.org
Mon Jan 4 20:28:57 UTC 2016
#11352: Allow applying type to label
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner:
Type: feature | Status: new
request |
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.3
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
{{{#!hs
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE DataKinds #-}
import GHC.TypeLits
import GHC.OverloadedLabels
instance IsLabel "answer" Int where
fromLabel _ = 42
answer :: IsLabel "answer" a => a
answer = #answer
}}}
The follow works:
{{{#!hs
>>> answer @Int
42
}}}
but fails with a label:
{{{#!hs
>>> #answer @Int
<interactive>:...:1: error:
• Cannot not apply expression of type ‘t0’
to a visible type argument ‘Int’
• In the expression: #answer @Int
In an equation for ‘it’: it = #answer @Int
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11352>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list