Skip to content

Releases: purescript/purescript

v0.15.13-0

03 Nov 17:58
4f4672d
Compare
Choose a tag to compare
v0.15.13-0 Pre-release
Pre-release

This is an automated preview release. Get the latest stable release here.

v0.15.12

07 Oct 11:22
2412101
Compare
Choose a tag to compare

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. The ObjectUpdate expression
    constructor now contains a Maybe 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 the v type variable would not be inferred
    to String. 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:

v0.15.11

29 Sep 14:06
843c109
Compare
Choose a tag to compare

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

08 Aug 19:25
8ede652
Compare
Choose a tag to compare
v0.15.11-3 Pre-release
Pre-release

This is an automated preview release. Get the latest stable release here.

v0.15.11-2

25 Jul 14:39
4afea2f
Compare
Choose a tag to compare
v0.15.11-2 Pre-release
Pre-release

This is an automated preview release. Get the latest stable release here.

v0.15.11-1

24 Jul 16:15
9074fc6
Compare
Choose a tag to compare
v0.15.11-1 Pre-release
Pre-release

This is an automated preview release. Get the latest stable release here.

v0.15.11-0

22 Jul 15:08
6431cd3
Compare
Choose a tag to compare
v0.15.11-0 Pre-release
Pre-release

This is an automated preview release. Get the latest stable release here.

v0.15.10

18 Jul 21:12
193977e
Compare
Choose a tag to compare

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 or data 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 for purs 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 compile LoginPage.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

03 Jul 11:39
a6f6dcc
Compare
Choose a tag to compare
v0.15.10-1 Pre-release
Pre-release

This is an automated preview release. Get the latest stable release here.

v0.15.10-0

30 May 15:25
0d33710
Compare
Choose a tag to compare
v0.15.10-0 Pre-release
Pre-release

This is an automated preview release. Get the latest stable release here.