Skip to content

Commit

Permalink
fix: minor adjustments and moved LCG spec file
Browse files Browse the repository at this point in the history
  • Loading branch information
aboeglin committed Mar 27, 2024
1 parent 676f97b commit 62849ef
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 3 additions & 0 deletions compiler/main/Infer/ToSolved.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ tSubst = TVar (TV (-1) Star)
toSolved :: Can.Exp -> Slv.Exp
toSolved (Can.Canonical area exp) = case exp of
Can.LNum v -> Slv.Typed ([] :=> tNumber) area (Slv.LNum v)
Can.LByte v -> Slv.Typed ([] :=> tByte) area (Slv.LNum v)
Can.LShort v -> Slv.Typed ([] :=> tShort) area (Slv.LNum v)
Can.LInt v -> Slv.Typed ([] :=> tInteger) area (Slv.LNum v)
Can.LFloat v -> Slv.Typed ([] :=> tFloat) area (Slv.LFloat v)
Can.LStr v -> Slv.Typed ([] :=> tStr) area (Slv.LStr v)
Can.LChar v -> Slv.Typed ([] :=> tChar) area (Slv.LChar v)
Expand Down
4 changes: 1 addition & 3 deletions prelude/__internal__/Random/LCG.mad
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { Maybe } from "Maybe"

import Byte from "Byte"
import ByteArray from "ByteArray"
import Float from "Float"
import Integer from "Integer"
Expand Down Expand Up @@ -118,8 +117,7 @@ export mkSeed = pipe(
stringToInt :: String -> Integer
export stringToInt = pipe(
ByteArray.fromString,
ByteArray.reduce((hash, byte) => hash + (byte << 6) + (byte << 16), 0),
Byte.toInteger,
ByteArray.reduce((hash, byte) => hash + (Integer.fromByte(byte) << 6) + (Integer.fromByte(byte) << 16), 0),
)

mkSeedFromString :: String -> Seed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Float from "Float"
import Math from "Math"
import String from "String"
import { assertEquals, test } from "Test"

Expand Down Expand Up @@ -81,7 +79,7 @@ test(
)(seed)
return assertEquals(
shuffled,
["kmjbgzxorpvuqtadlfhynwcei", "vqpmxicafdrylhkbuzoetwjgn", "rlwqcnjkzbfeuovmydaghipxt"],
["jwmzptgxeflqainkrbyhvudoc", "euackygdptqrjvilbfoxwhznm", "phjmlogzkyrbewvqftnduxcia"],
)
},
)

0 comments on commit 62849ef

Please sign in to comment.