Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,400
    • Issues 5,400
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 590
    • Merge requests 590
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #10139
Closed
Open
Issue created Mar 06, 2015 by nitromaster101@trac-nitromaster101

Coercible causes ghc to hang

Consider my two instance declarations. The second one will hang ghc. If I change (coerce) to (coerce :: Normal a -> Sized a) it compiles fine. The first declaration also works fine.

{-# LANGUAGE TypeFamilies, FlexibleInstances #-}

import qualified Data.FingerTree as FT
import GHC.Exts

class DOps a where
  plus :: a -> D a -> a

type family D a :: *
type instance D (FT.FingerTree (Size Int, v) (Sized a)) = [Diff (Normal a)]

type family Normal a :: *

data Diff a = Add Int a

newtype Sized a = Sized a
newtype Size a = Size a

-- This works:
instance (FT.Measured (Size Int, v) (Sized a), Coercible (Normal a) (Sized a)) => DOps (FT.FingerTree (Size Int, v) (Sized a)) where
  plus = foldr (\(Add index val) seq -> FT.singleton ((coerce) val))

-- This hangs:
instance (FT.Measured (Size Int, v) (Sized a), Coercible (Normal a) (Sized a)) => DOps (FT.FingerTree (Size Int, v) (Sized a)) where
  plus = foldr (flip f)
    where f seq x = case x of
            Add index val -> FT.singleton ((coerce) val)
$ ~/downloads/ghc-7.10.0.20150123/out/bin/ghci --version
The Glorious Glasgow Haskell Compilation System, version 7.10.0.20150123
Trac metadata
Trac field Value
Version 7.10.1-rc2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking