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,359
    • Issues 5,359
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 573
    • Merge requests 573
  • 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
  • #11396
Closed
Open
Issue created Jan 10, 2016 by Lemming@trac-Lemming

deriving Ix with custom ifThenElse causes "Bad call to tagToEnum#"

$ cat IfThenElseIx.hs
{-# LANGUAGE RebindableSyntax #-}
module IfThenElseIx where

import Data.Ix (Ix, )

import Prelude


ifThenElse :: Bool -> a -> a -> a
ifThenElse True x _ = x
ifThenElse False _ x = x

data T = A | B deriving (Eq, Ord, Ix)

$ ghci-8.0.0.20160109 IfThenElseIx.hs
GHCi, version 8.0.0.20160109: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling IfThenElseIx     ( IfThenElseIx.hs, interpreted )

IfThenElseIx.hs:13:35: error:
    • Bad call to tagToEnum# at type a_a2ky
        Specify the type by giving a type signature
        e.g. (tagToEnum# x) :: Bool
    • In the second argument of ‘ifThenElse’, namely
        ‘(GHC.Prim.tagToEnum# (c# GHC.Prim.<=# b#))’
      In the expression:
        if (GHC.Prim.tagToEnum# (c# GHC.Prim.>=# a#)) then
            (GHC.Prim.tagToEnum# (c# GHC.Prim.<=# b#))
        else
            False
      In a case alternative:
          c#
            -> if (GHC.Prim.tagToEnum# (c# GHC.Prim.>=# a#)) then
                   (GHC.Prim.tagToEnum# (c# GHC.Prim.<=# b#))
               else
                   False
      When typechecking the code for ‘GHC.Arr.inRange’
        in a derived instance for ‘Ix T’:
        To see the code I am typechecking, use -ddump-deriv
Failed, modules loaded: none.
Trac metadata
Trac field Value
Version 8.0.1-rc1
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