Skip to content

Commit

Permalink
Var: m refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton-Latukha committed Feb 8, 2021
1 parent 3b8845f commit 850f569
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Nix/Var.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Data.STRef
import Type.Reflection ((:~:)(Refl))

import Unsafe.Coerce
import Data.Bool ( bool )

type Var m = Ref m

Expand All @@ -37,7 +38,15 @@ atomicModifyVar = atomicModifyRef

--TODO: Upstream GEq instances
instance GEq IORef where
a `geq` b = if a == unsafeCoerce b then Just $ unsafeCoerce Refl else Nothing
a `geq` b =
bool
Nothing
(pure $ unsafeCoerce Refl)
(a == unsafeCoerce b )

instance GEq (STRef s) where
a `geq` b = if a == unsafeCoerce b then Just $ unsafeCoerce Refl else Nothing
a `geq` b =
bool
Nothing
(pure $ unsafeCoerce Refl )
(a == unsafeCoerce b)

0 comments on commit 850f569

Please sign in to comment.