[GHC] #14155: GHC mentions unlifted types out of the blue (to me anyway)

GHC ghc-devs at haskell.org
Thu Aug 24 23:08:37 UTC 2017


#14155: GHC mentions unlifted types out of the blue (to me anyway)
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * cc: RyanGlScott (added)


Comment:

 Here's a simpler version which removes some cruft:

 {{{#!hs
 newtype R a = R ((a -> a) -> a)

 newtype Swap p f g a = Swap (p g f a)

 class IxPointed m where
   ireturn :: a -> m i i a

 instance IxPointed f => IxPointed (Swap f) where
   ireturn a = R (ireturn a)
 }}}

 {{{
 $ /opt/ghc/8.2.1/bin/ghci Bug.hs
 GHCi, version 8.2.1: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 [1 of 1] Compiling Main             ( Bug.hs, interpreted )

 Bug.hs:9:15: error:
     • Couldn't match expected type ‘Swap f i i a’
                   with actual type ‘R a’
     • In the expression: R (ireturn a)
       In an equation for ‘ireturn’: ireturn a = R (ireturn a)
       In the instance declaration for ‘IxPointed (Swap f)’
     • Relevant bindings include
         a :: a (bound at Bug.hs:9:11)
         ireturn :: a -> Swap f i i a (bound at Bug.hs:9:3)
   |
 9 |   ireturn a = R (ireturn a)
   |               ^^^^^^^^^^^^^

 Bug.hs:9:18: error:
     • Couldn't match a lifted type with an unlifted type
     • In the first argument of ‘R’, namely ‘(ireturn a)’
       In the expression: R (ireturn a)
       In an equation for ‘ireturn’: ireturn a = R (ireturn a)
     • Relevant bindings include
         a :: a (bound at Bug.hs:9:11)
         ireturn :: a -> Swap f i i a (bound at Bug.hs:9:3)
   |
 9 |   ireturn a = R (ireturn a)
   |                  ^^^^^^^^^
 }}}

 This is a regression form 8.0.2, where the error message didn't mention
 unlifted types:

 {{{
 $ /opt/ghc/8.0.2/bin/ghci Bug.hs
 GHCi, version 8.0.2: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 [1 of 1] Compiling Main             ( Bug.hs, interpreted )

 Bug.hs:9:15: error:
     • Couldn't match expected type ‘Swap f i i a’
                   with actual type ‘R a’
     • In the expression: R (ireturn a)
       In an equation for ‘ireturn’: ireturn a = R (ireturn a)
       In the instance declaration for ‘IxPointed (Swap f)’
     • Relevant bindings include
         a :: a (bound at Bug.hs:9:11)
         ireturn :: a -> Swap f i i a (bound at Bug.hs:9:3)

 Bug.hs:9:18: error:
     • Couldn't match type ‘m0 (a -> a)’ with ‘(->)’
       Expected type: (a -> a) -> a
         Actual type: m0 (a -> a) (a -> a) a
     • In the first argument of ‘R’, namely ‘(ireturn a)’
       In the expression: R (ireturn a)
       In an equation for ‘ireturn’: ireturn a = R (ireturn a)
     • Relevant bindings include
         a :: a (bound at Bug.hs:9:11)
         ireturn :: a -> Swap f i i a (bound at Bug.hs:9:3)
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14155#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list