Skip to content

Instantly share code, notes, and snippets.

@relrod
Created April 1, 2017 06:10
Show Gist options
  • Save relrod/17d928ffb2838c31a23288a007b8df22 to your computer and use it in GitHub Desktop.
Save relrod/17d928ffb2838c31a23288a007b8df22 to your computer and use it in GitHub Desktop.
Simpler(-ish) GHC bug reproducer
module Main where
import Control.Monad
import Data.AffineSpace
import Data.Thyme.Clock
import Data.Thyme.Time
filterTimes
:: [UTCTime]
-> UTCTime
-> NominalDiffTime
-> [UTCTime]
filterTimes ts u d =
let x t = abs (t .-. u) - realToFrac d < 0
in mfilter x ts
main :: IO ()
main = do
let t = mkUTCTime (fromGregorian 2017 03 29) 21700
entries = [t]
aBitLater = mkUTCTime (fromGregorian 2017 03 29) 21750
diff = 150
print $ filterTimes entries aBitLater diff
#!/usr/bin/env bash
function echoAndRun {
echo "$1"
$1
}
echoAndRun "rm *.o *.hi"
echoAndRun "ghc -Wall --make -O0 repro.hs"
echoAndRun "./repro"
echoAndRun "rm *.o *.hi"
echoAndRun "ghc -Wall --make -O repro.hs"
echoAndRun "./repro"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment