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,247
    • Issues 5,247
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 577
    • Merge requests 577
  • 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
  • #16373
Closed
Open
Issue created Feb 28, 2019 by roland@trac-roland

Strings from symbolVal not simplified at compile time

Compiling

{-# LANGUAGE DataKinds #-}

module Test where

import GHC.TypeLits
import Data.Proxy

testAA :: Bool
testAA = symbolVal (Proxy :: Proxy "A") == symbolVal (Proxy :: Proxy "A")

testAB :: Bool
testAB = symbolVal (Proxy :: Proxy "A") == symbolVal (Proxy :: Proxy "B")

with

ghc -O -ddump-simpl -dsuppress-all Test.hs

yields:

-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
testAA2
testAA2 = "A"#

-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
testAA1
testAA1 = unpackCString# testAA2

-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
testAB1
testAB1 = "B"#

-- RHS size: {terms: 4, types: 0, coercions: 0, joins: 0/0}
testAB
testAB = eqString testAA1 (unpackCString# testAB1)

-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
testAA
testAA = eqString testAA1 testAA1

Removing testAA makes testAB simplify to False, and so does removing testAB's type signature.

I would expect each definition to simplify to True or False, no matter whether it has a type signature or whether the same string is used elsewhere in the same file.

Trac metadata
Trac field Value
Version 8.6.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (CodeGen)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Edited Mar 11, 2019 by roland
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking