Last active
March 6, 2017 08:33
-
-
Save PkmX/bc72ab799e09127448d0a043d2840f2a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
module Main where | |
import Data.Reflection | |
newtype QDouble = QDouble Double | |
newtype Step = Step Double | |
instance Given Step => Eq QDouble where | |
QDouble x == QDouble y = abs (x - y) < s | |
where Step s = given | |
main :: IO () | |
main = do | |
n :: Double <- read <$> getLine | |
print $ give (Step n) $ QDouble 0.5 == QDouble 0.6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment