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,259
    • Issues 5,259
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 565
    • Merge requests 565
  • 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
  • #5038
Closed
Open
Issue created Mar 22, 2011 by Philonous@trac-Philonous

internal error with rebindable if-then-else

Defining ifThenElse in a module with RebindableSyntax enabled and using if-then-else in the same module leads to an internal ghc error.

ifThenElse.hs:

{-# LANGUAGE RebindableSyntax #-}

module IfThenElse (ifThenElse) where

import Prelude (Bool(..))

ifThenElse True t f = t
ifThenElse False t f = f

foo = if True then () else ()

Error message:

# ghc IfThenElse.hs
[1 of 1] Compiling IfThenElse       ( IfThenElse.hs, IfThenElse.o )

IfThenElse.hs:10:7:
    GHC internal error: `ifThenElse' is not in scope during type checking, but it passed the renamer
    tcg_type_env of environment: []
    tcl_env of environment: []
    In the expression: if True then () else ()
    In an equation for `foo': foo = if True then () else ()

Importing ifThenElse from another module (even with RebindableSyntax enabled) will make the error go away.

Trac metadata
Trac field Value
Version 7.0.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC p.balzarek@googlemail.com
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