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,390
    • Issues 4,390
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 373
    • Merge Requests 373
  • 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
  • #2701

Closed
Open
Opened Oct 16, 2008 by batterseapower@trac-batterseapower

Cannot derive Data for structures containing unboxed values

Trying to compile this:

{-# LANGUAGE MagicHash, DeriveDataTypeable #-}
module Test where

import GHC.Prim

import Data.Data
import Data.Typeable

data Foo = MkFoo Int#
         deriving (Typeable, Data)

Results in an error:

$ ghc/stage1-inplace/ghc --make ~/DerivingUnboxed.hs 
[1 of 1] Compiling Test             ( /Users/mbolingbroke/DerivingUnboxed.hs, /Users/mbolingbroke/DerivingUnboxed.o )

/Users/mbolingbroke/DerivingUnboxed.hs:10:29:
    Couldn't match kind `#' against `*'
    When matching the kinds of `Int# :: #' and `d :: *'
      Expected type: d
      Inferred type: Int#
    In the first argument of `z', namely `MkFoo'

/Users/mbolingbroke/DerivingUnboxed.hs:10:29:
    Couldn't match kind `#' against `*'
    When matching the kinds of `Int# :: #' and `b :: *'
      Expected type: b
      Inferred type: Int#
    In the first argument of `z', namely `MkFoo'

I'm not sure if this is really a bug or not. It might be nice if deriving Data handled this case by reboxing Int#, or alternatively if it gave a clear error messages about not being able to handle unboxed values.

Trac metadata
Trac field Value
Version 6.10.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
6.10.1
Milestone
6.10.1
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#2701