Ok,
here is what you can do to get it to compile (tested only for Excercise 2):
- go in the folder
- do
spago upgrade-set
(this will update the latest set)
- in
packages.dhall
change the override for test-unit
:
let overrides =
{ test-unit =
{ dependencies =
[ "aff"
, "either"
, "prelude"
, "effect"
, "quickcheck"
, "free"
, "strings"
, "lists"
, "js-timers"
, "avar"
]
, repo = "https://github.com/mhmdanas/purescript-test-unit.git"
, version = "101026860937735c7e3e46f249f16d56d9c875b2"
}
}
this will point to the commit in the PR I linked above
Now math
was deprecated but is used here - you can switch this for number - so remove math
from the dependencies in spago.dhall
and grab numbers
(either add it there or do spago install numbers
Change the Solutions.purs
file-improrts to
import Data.Int (rem)
import Data.Number (pi, sqrt)
(basically switching Math
for Data.Numbers
)
and now spago build
and spago test
should work
Here is all of the packages.dhall
file:
let upstream =
https://github.com/purescript/package-sets/releases/download/psc-0.15.0-20220505/packages.dhall
sha256:ba57c25c86fd54c2b672cda3a6836bbbdff4b1bbf946bceaabb64e5a10285638
let overrides =
{ test-unit =
{ dependencies =
[ "aff"
, "either"
, "prelude"
, "effect"
, "quickcheck"
, "free"
, "strings"
, "lists"
, "js-timers"
, "avar"
]
, repo = "https://github.com/mhmdanas/purescript-test-unit.git"
, version = "101026860937735c7e3e46f249f16d56d9c875b2"
}
}
let additions =
{ react-basic =
{ dependencies = [ "prelude", "effect", "record" ]
, repo = "https://github.com/lumihq/purescript-react-basic.git"
, version = "main"
}
, react-basic-hooks =
{ dependencies =
[ "prelude"
, "aff-promise"
, "aff"
, "console"
, "datetime"
, "effect"
, "either"
, "indexed-monad"
, "maybe"
, "newtype"
, "numbers"
, "react-basic"
, "type-equality"
, "unsafe-coerce"
, "unsafe-reference"
, "web-html"
]
, repo =
"https://github.com/milesfrain/purescript-react-basic-hooks.git"
, version = "v6.3.0-ps-0.14"
}
, react-basic-dom =
{ dependencies =
[ "prelude"
, "effect"
, "foreign-object"
, "react-basic"
, "unsafe-coerce"
, "web-dom"
, "web-events"
, "web-file"
, "web-html"
]
, repo = "https://github.com/lumihq/purescript-react-basic-dom.git"
, version = "v3.2.0"
}
, indexed-monad =
{ dependencies = [ "control", "newtype" ]
, repo = "https://github.com/garyb/purescript-indexed-monad.git"
, version = "master"
}
}
in upstream // overrides // additions
this is the new spago.dhall
:
{-
Welcome to a Spago project!
You can edit this file as you like.
-}
{ name = "my-project"
, dependencies =
[ "console"
, "effect"
, "foldable-traversable"
, "integers"
, "lists"
, "numbers"
, "prelude"
, "psci-support"
, "test-unit"
]
, packages = ./packages.dhall
, sources = [ "src/**/*.purs", "test/**/*.purs" ]
}
and the Solution.purs
:
module Test.NoPeeking.Solutions where
import Prelude
import Data.Int (rem)
import Data.Number (pi, sqrt)
-- ANCHOR: diagonal
diagonal w h = sqrt (w * w + h * h)
-- ANCHOR_END: diagonal
circleArea r = pi * r * r
leftoverCents n = rem n 100
sadly you will have to do the same with every exercise for now till somebody fixed the book (I think somebody posted there that they are already trying/doing it - so give the community a few weeks please - the new release is just a week old)
Have fun