Releases: purescript/purescript
v0.15.13-0
This is an automated preview release. Get the latest stable release here.
v0.15.12
New features:
-
Move the closed record update optimization (#4489 by @rhendric)
For consumers of CoreFn like alternate backends, the optimization of
replacing a closed record update with an object literal has now been moved to
the point of desugaring CoreFn into JS. TheObjectUpdate
expression
constructor now contains aMaybe
field holding a list of record labels to
be copied as-is, for backends that want to perform this optimization also. -
Allow instances that require
Fail
to be empty (#4490 by @rhendric)A class instance declaration that has
Prim.TypeError.Fail
as a constraint
will never be used. In light of this, such instances are now allowed to have
empty bodies even if the class has members.(Such instances are still allowed to declare all of their members, and it is
still an error to specify some but not all members.)
Bugfixes:
-
Stop emitting warnings for wildcards in Visible Type Applications (#4492 by @JordanMartinez)
Previously, the below usage of a wildcard (i.e.
_
) would
incorrectly cause the compiler to emit a warning.f :: forall @a. a -> a f = identity x :: { x :: Int } x = f @{ x :: _ } { x: 42 }
-
Infer types using VTA inside a record (#4501 by @JordanMartinez)
Previously,
use
would fail to compile
because thev
type variable would not be inferred
toString
. Now the below code compiles:reflect :: forall @t v . Reflectable t v => v reflect = reflectType (Proxy @t) use :: String use = show { asdf: reflect @"asdf" }
Internal:
-
Use
gh
for release artifacts (#4493 by @rhendric, #4509 by @JordanMartinez) -
Stop triggering CI on non-code-related changes (e.g. Readme) (#4502 by @JordanMartinez)
v0.15.11
Please use 0.15.12
instead of this release. There was an issue with the Linux build. This release's notes were moved into 0.15.12
's release notes.
v0.15.11-3
This is an automated preview release. Get the latest stable release here.
v0.15.11-2
This is an automated preview release. Get the latest stable release here.
v0.15.11-1
This is an automated preview release. Get the latest stable release here.
v0.15.11-0
This is an automated preview release. Get the latest stable release here.
v0.15.10
New features:
-
Implement visible type applications
The compiler now supports visible type applications, allowing the user to instantiate one or more "visible" type variables to a specific type.
A "visible" type variable is a type variable in a
forall
binder that appears prefixed with an@
, like the following example:id :: forall @a. a -> a -- or with kinds: `forall (@a :: Type). a -> a` id a = a
We can then use type application syntax to instantiate this binding to a specific type:
idInt :: Int -> Int idInt = id @Int example :: Int example = id @Int 0
Type variables appearing in
class
ordata
are automatically visible, meaning that they do not require annotations:data Maybe a = Just a | Nothing nothingInt :: Maybe Int nothingInt = Nothing @Int class Identity a where identity :: a -> a instance Identity Int where identity a = a identityInt = identity @Int -- This throws a `NoInstanceFound` error. identityNumber = identity @Number
Lastly, visible type variables can also be skipped with a wildcard (i.e.
_
)data Either a b = Left a | Right b example = Left @_ @Number 0
Note that performing a type application with a type that has no visible type variables throws an error:
module Main where id :: forall a. a -> a id a = a idInt = id @Int {- Error found: in module Main at Main.purs:6:9 - 6:16 (line 6, column 9 - line 6, column 16) An expression of polymorphic type with the invisible type variable a: forall a. a -> a cannot be applied to: Int while inferring the type of id in value declaration idInt See https://github.com/purescript/documentation/blob/master/errors/CannotApplyExpressionOfTypeOnType.md for more information, or to contribute content related to this error. -}
Similarly, monomorphic types also cannot be used for type applications:
module Main where idInt :: Int -> Int idInt a = a example = idInt @Int {- Error found: in module Main at Main.purs:6:11 - 6:21 (line 6, column 11 - line 6, column 21) An expression of monomorphic type: Int -> Int cannot be applied to: Int while inferring the type of idInt in value declaration example See https://github.com/purescript/documentation/blob/master/errors/CannotApplyExpressionOfTypeOnType.md for more information, or to contribute content related to this error. -}
-
Exclude files from compiler input (#4480 by @i-am-the-slime)
The compiler now supports excluding files from the globs given to it as input.
This means there's now a new option forpurs compile
, namely
--exclude-files
(or the short version-x
):> purs compile --help Usage: purs compile [FILE] [-x|--exclude-files ARG] [-o|--output ARG] ... Compile PureScript source files Available options: -h,--help Show this help text FILE The input .purs file(s). -x,--exclude-files ARG Glob of .purs files to exclude from the supplied files. ...
This allows you to keep related files closer together (that is, colocate them).
Consider a setup like the following:
src/ Main.purs View/ LoginPage.purs LoginPageTest.purs LoginPageStories.purs
In order to exclude the files in the example above you can now invoke
purs
like this and it will only compileLoginPage.purs
:purs compile "src/**/*.purs" --exclude-files "src/**/*Stories.purs" -x "src/**/*Test.purs"
With
spago
, the equivalent command is:spago build --purs-args '-x "src/**/*Test.purs" -x "src/**/*Stories.purs"'
v0.15.10-1
This is an automated preview release. Get the latest stable release here.
v0.15.10-0
This is an automated preview release. Get the latest stable release here.