[GHC] #14363: :type hangs on coerce

GHC ghc-devs at haskell.org
Tue Oct 17 16:30:24 UTC 2017


#14363: :type hangs on coerce
-------------------------------------+-------------------------------------
        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:                    |
-------------------------------------+-------------------------------------
Description changed by Iceland_jack:

Old description:

> This works
>
> {{{
>  ghci -ignore-dot-ghci
> GHCi, version 8.2.1: http://www.haskell.org/ghc/  :? for help
> Prelude> import Data.Coerce
> Prelude Data.Coerce> :t [fmap, coerce]
>
> <interactive>:1:8: error:
>     • Occurs check: cannot construct the infinite type: b ~ f b
>         arising from a use of ‘coerce’
>     • In the expression: coerce
>       In the expression: [fmap, coerce]
>
> }}}
>
> But doing it with `contra`
>
> {{{
> Prelude Data.Coerce> contra = undefined :: Functor f => (b -> a) -> (f a
> -> f b)
> }}}
>
> it hangs
>
> {{{
> Prelude Data.Coerce> :t [coerce, contra]
> ^CInterrupted.
> Prelude Data.Coerce> :t [contra, coerce]
> ^CInterrupted.
> }}}

New description:

 This works

 {{{
 $ ghci -ignore-dot-ghci
 GHCi, version 8.2.1: http://www.haskell.org/ghc/  :? for help
 Prelude> import Data.Coerce
 Prelude Data.Coerce> :t [fmap, coerce]

 <interactive>:1:8: error:
     • Occurs check: cannot construct the infinite type: b ~ f b
         arising from a use of ‘coerce’
     • In the expression: coerce
       In the expression: [fmap, coerce]

 }}}

 But doing it with `contra`

 {{{
 Prelude Data.Coerce> contra = undefined :: Functor f => (b -> a) -> (f a
 -> f b)
 }}}

 it hangs

 {{{
 Prelude Data.Coerce> :t [coerce, contra]
 ^CInterrupted.
 Prelude Data.Coerce> :t [contra, coerce]
 ^CInterrupted.
 }}}

--

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


More information about the ghc-tickets mailing list