Skip to content

GitLab

  • Menu
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 4,862
    • Issues 4,862
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 455
    • Merge requests 455
  • 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 Compiler
  • GHCGHC
  • Issues
  • #21036
Closed
Open
Created Feb 03, 2022 by Gergő Érdi@cactusContributor

Imported definition not specialized

As of b6f7d145, I am trying to get GHC to specialize away all dictionary-passing, but it is failing in a very simple cross-module case.

Given the following two modules:

module Print where

import Prelude (String, IO, putStrLn, Show(..))

print :: (Show a) => a -> IO ()
print x = putStrLn (show x)
module Main1 (main) where

import Print
import Prelude (Show(..), IO)

data T = A | B deriving Show

main :: IO ()
main = print A

I am compiling Main1 with the following optimization flags:

-fspecialise -fenable-rewrite-rules \
-fspecialise-aggressively -fsolve-constant-dicts -fcross-module-specialise \
-fexpose-all-unfoldings

I expected the combination of expose-all-unfoldings and cross-module-specialise to result in a T-specialized print, but alas, the main I get still has dictionary passing:

-- RHS size: {terms: 3, types: 1, coercions: 0, joins: 0/0}
main :: IO ()
[GblId]
main = print @T Main1.$fShowT Main1.A

What is missing here to specialize print?

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking