Skip to content

Commit ae51fe0

Browse files
committed
Type.Infer: unops: refactor
1 parent dfe790a commit ae51fe0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Nix/Type/Infer.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,13 @@ generalize free t = Forall as t
294294
as = Set.toList $ ftv t `Set.difference` free
295295

296296
unops :: Type -> NUnaryOp -> [Constraint]
297-
unops u1 = \case
298-
NNot -> [EqConst u1 (typeFun [typeBool, typeBool])]
299-
NNeg ->
300-
[ EqConst
301-
u1
302-
(TMany [typeFun [typeInt, typeInt], typeFun [typeFloat, typeFloat]])
303-
]
297+
unops u1 op =
298+
[ EqConst u1
299+
(case op of
300+
NNot -> typeFun [typeBool , typeBool ]
301+
NNeg -> TMany [typeFun [typeInt, typeInt], typeFun [typeFloat, typeFloat]]
302+
)
303+
]
304304

305305
binops :: Type -> NBinaryOp -> [Constraint]
306306
binops u1 = \case

0 commit comments

Comments
 (0)