Skip to content

Commit 0375504

Browse files
committed
Var: m refactor
1 parent fa7aab2 commit 0375504

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Nix/Var.hs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import Data.STRef
1515
import Type.Reflection ((:~:)(Refl))
1616

1717
import Unsafe.Coerce
18+
import Data.Bool ( bool )
1819

1920
type Var m = Ref m
2021

@@ -37,7 +38,15 @@ atomicModifyVar = atomicModifyRef
3738

3839
--TODO: Upstream GEq instances
3940
instance GEq IORef where
40-
a `geq` b = if a == unsafeCoerce b then Just $ unsafeCoerce Refl else Nothing
41+
a `geq` b =
42+
bool
43+
Nothing
44+
(pure $ unsafeCoerce Refl)
45+
(a == unsafeCoerce b )
4146

4247
instance GEq (STRef s) where
43-
a `geq` b = if a == unsafeCoerce b then Just $ unsafeCoerce Refl else Nothing
48+
a `geq` b =
49+
bool
50+
Nothing
51+
(pure $ unsafeCoerce Refl )
52+
(a == unsafeCoerce b)

0 commit comments

Comments
 (0)