Skip to content

Releases: purescript/purescript

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.

v0.15.9

29 Apr 17:45
b1825f9
Compare
Choose a tag to compare

New features:

  • Add release artifacts for Linux and macOS running on the ARM64 architecture. (#4455 by @f-f)

Bugfixes:

  • Fix prerelease version number on macOS (#4461 by @rhendric)

  • Consider fixity declarations during linting (#4462 by @ozkutuk)

  • Defer monomorphization for data constructors (#4376 by @purefunctor)

    In 0.15.4 and earlier, the compiler monomorphizes type
    constructors early, yielding the following type:

    > :t Nothing
    forall (a1 :: Type). Maybe a1
    
    > :t { a : Nothing }
    forall (a1 :: Type).
      { a :: Maybe a1
      }

    With this change, the monomorphization introduced in
    #835 is
    deferred to only when it's needed, such as when constructors are
    used as values inside of records.

    > :t Nothing
    forall a. Maybe a
    
    > :t { a : Nothing }
    forall (a1 :: Type).
      { a :: Maybe a1
      }

    Also as a consequence, record updates should not throw
    ConstrainedTypeUnified in cases such as:

    v1 :: { a :: Maybe Unit }
    v1 = { a : Just Unit }
    
    v2 :: { a :: Maybe Unit }
    v2 = let v3 = v1 { a = mempty } in v3
  • Update installer to version 0.3.5 to support ARM builds (#4468 and #4469 by @rhendric)

  • Fix exhaustiveness checking to account for case guards (#4467 by @purefunctor)

Internal:

v0.15.9-8

26 Apr 20:25
5b9031a
Compare
Choose a tag to compare
v0.15.9-8 Pre-release
Pre-release

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

v0.15.9-7

26 Apr 09:01
198a49e
Compare
Choose a tag to compare
v0.15.9-7 Pre-release
Pre-release

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

v0.15.9-6

22 Apr 05:47
284cefc
Compare
Choose a tag to compare
v0.15.9-6 Pre-release
Pre-release

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