Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,393
    • Issues 4,393
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 374
    • Merge Requests 374
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #5015

Closed
Open
Opened Mar 11, 2011 by ToRA@trac-ToRA

Can't unsafeCoerce a GADT with a coercion

type family Blah a 
type instance Blah Int = Int
data E where
  E :: (Blah a ~ Int) => a -> E
*Example Unsafe.Coerce GHC.Prim> (unsafeCoerce E) :: Any

<interactive>:1:15:
    Couldn't match type `Blah a0' with `Int'
    In the first argument of `unsafeCoerce', namely `E'
    In the expression: (unsafeCoerce E) :: Any
    In an equation for `it': it = (unsafeCoerce E) :: Any

This also doesn't work with less dangerous operators, like seq:

*Example Unsafe.Coerce GHC.Prim> (id E) `seq` ()

<interactive>:1:5:
    Couldn't match type `Blah a0' with `Int'
    In the first argument of `id', namely `E'
    In the first argument of `seq', namely `(id E)'
    In the expression: (id E) `seq` ()
Trac metadata
Trac field Value
Version 7.0.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#5015