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,312
    • Issues 4,312
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 385
    • Merge Requests 385
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #2163

Closed
Open
Opened Mar 17, 2008 by Ian Lynagh <igloo@earth.li>@trac-igloo

GHC makes thunks for Integers we are strict in

We know that timesInteger is strict in both arguments:

$ ./ghc --show-iface ~/ghc/darcs/val/libraries/base/dist/build/GHC/Num.hi | grep -C2 "^timesInteger"
plusInteger :: GHC.Num.Integer -> GHC.Num.Integer -> GHC.Num.Integer
  {- Arity: 2 HasNoCafRefs Strictness: SS -}
timesInteger :: GHC.Num.Integer -> GHC.Num.Integer -> GHC.Num.Integer
  {- Arity: 2 HasNoCafRefs Strictness: SS -}
class (GHC.Base.Eq a, GHC.Show.Show a) => Num a

but given this code:

module W where

f :: Integer -> Integer
f x = let x' = x + 3
      in x' * x'

we still make a thunk for x':

$ ./ghc -c w.hs -O -fforce-recomp -ddump-simpl
==================== Tidy Core ====================
W.lvl :: GHC.Num.Integer
[GlobalId]
[NoCafRefs
 Str: DmdType]
W.lvl = GHC.Num.S# 3

W.f :: GHC.Num.Integer -> GHC.Num.Integer
[GlobalId]
[Arity 1
 NoCafRefs
 Str: DmdType S]
W.f =
  \ (x_a5h :: GHC.Num.Integer) ->
    let {
      x'_sa7 [ALWAYS Just S] :: GHC.Num.Integer
      [Str: DmdType]
      x'_sa7 = GHC.Num.plusInteger x_a5h W.lvl } in
    GHC.Num.timesInteger x'_sa7 x'_sa7

The same is true in both the 6.8 branch and the HEAD.

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