Skip to content

Rewrite rule breaks code when used with ghc -O #58

Open
@relrod

Description

@relrod

I have the following code:

module Main where

import Data.Thyme.Time

main :: IO ()
main = print $ (realToFrac (150 :: NominalDiffTime) :: NominalDiffTime)
  • When I compile it with ghc --make -O0, I get 150s
  • When I compile it with ghc --make -O, I get 0s

At first I thought it was a bug in GHC's optimizer, but then I saw the rewrite rules in Thyme and now I'm not sure where to file the bug, so I'm starting here. I'm able to reproduce this on GHC 8.0.1, 8.0.2, and 7.10.3.

Let me know if you need any more information, I'm happy to provide it or help test a fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions