A strongly-typed language that compiles to JavaScript
OTHER License
Bot releases are hidden (Show)
Published by paf31 over 9 years ago
(#347, @paf31)
This feature allows type variables which are bound by a forall
keyword to be used inside type annotations in the body of the function. For example, suppose we want to define a map
function on a List
type:
data List a = Nil | Cons a (List a)
map :: forall a b. (a -> b) -> List a -> List b
map f = go
where
go Nil = Nil
go (Cons x xs) = Cons (f x) (map f xs)
To give a type to go
, we could previously use type wildcards:
go :: List _ -> List _
Now, we can refer to the types a
and b
inside the type of go
, giving a more precise type:
go :: List a -> List b
(@paf31, @apsk)
This feature allows rows to appear on the left of a =>
in a type signature. For example, given a MonadEff
class:
class MonadEff eff m where
liftEff :: forall a. Eff eff a -> m a
we can now write the following function which works in any Monad
supporting Trace
actions:
logging :: forall m a eff. (Monad m, MonadEff (trace :: Trace | eff) m) => String -> m a -> m a
logging s action = do
liftEff $ trace $ "Starting: " <> s
a <- action
liftEff $ trace $ "Done: " <> s
return a
let
bindings in psci
(#782, @paf31)
Any declaration can now be used inside a let
binding in psci
. For example, we can define data types or foreign imports:
> let data Foo = Foo | Bar | Baz
> let foreign import foo :: Foo -> String
The general form of a let
statement in psci
now contains one or more declarations of any type, and these declarations simply get added to the current module.
As a bonus, polymorphic functions bound using let
now work at multiple type instantiations in psci
:
> let f x = x
> if f true then f "true" else f "False"
"true"
psc-docs
(#802, @paf31)
Markdown can now be used for documentation purposes by using pipe characters to align content. For example:
-- | Create a copy of the array without its first element.
-- |
-- | Running time: `O(n)`, where `n` is the length of the array.
-- |
-- | This function is partial. Specifically, `tail []` is undefined.
tail :: forall a. [a] -> [a]
psc-docs
will insert this markdown content verbatim into your generated documentation.
psci
, to avoid situations where compiled code becomes out-of-date (@paf31)@
is a valid operator name again (#815, @paf31)Published by paf31 over 9 years ago
_.prop
(@garyb)The record part of a record updater can now be made into a wildcard, e.g. _ { foo = 1 }
(@garyb)
Extended infix expressions are now supported, (@paf31) e.g.
[1, 2, 3] `zipWith (+)` [4, 5, 6]
Published by paf31 over 9 years ago
Lightweight record constructors are now supported (@garyb):
person :: Maybe String -> Maybe Number -> Maybe Address -> Maybe Person
person = { name: _, age: _, location: _ } <$> name <*> age <*> location
Field accessor sections are now supported (@garyb):
getPersonName :: Maybe String
getPersonName = (.name) <$> getPersonInfo
Syntactic sugar has been introduced for object update functions:
updateName :: Person -> String -> Person
updateName person = person { name = _ }
Operator sections are now supported (@garyb)
psc-make
(@paulyoung)Published by paf31 over 9 years ago
Various small bug fixes.
Published by paf31 over 9 years ago
utf8-string
.Published by paf31 almost 10 years ago
Eff
block not being executed. (#759, @paf31):
instead of =
, to match record construction (#760, @leighman)psc-docs
now contains any inline comments which precede the corresponding declaration, and generated code preserves the same comments. (@paf31)pureST
function to run ST
computations in a pure context. (@KMahoney)Published by paf31 almost 10 years ago
Command line options with multiplicity 1 now require an equals symbol, e.g.
psc --main=Main --browser-namespace=PS
The Grunt and Gulp plugins already support this format.
optparse-applicative
instead of cmdtheline
(@anthoq88)STArray
out of Prelude. (@paf31)Published by paf31 almost 10 years ago
Published by paf31 almost 10 years ago
positive n | n > 0 = true
positive _ = false
but this is not:
positive n | n > 0
= true
positive _ = false
psci
(#615, @garyb)Published by paf31 almost 10 years ago
For more information on PureScript, see the purescript.org website.
Alternative
type class hierarchy was refactored. See here.--runtime-type-checks
has been removed. The recommended approach is to use purescript-foreign
. (@garyb)Unit
type is now used in the Prelude and core libraries to represent values containing no data. (@garyb)docgen
is now called psc-docs
.newtype
keyword. The runtime representation of a newtype is identical to that of the contained type. (@garyb)runFnN
and mkFnN
families of functions are now inlined by the optimizer, making interop with JavaScript functions of multiple arguments much simpler. (@paf31)Renamer
module now renames identifiers which shadow other names in scope, which greatly simplies code generation. (@garyb)psci
now provides the following new options:
:b
to browse a module (@ardumont):s
to show current imports or modules (@ardumont):k
to find the kind of a type constructor (@5outh)PureScript_paths
module has been removed, which makes distribution via binaries simpler. (@paf31)if
blocks now get optimized. (@garyb)psc
into the file as a comment. (@co-dh)()
is now valid syntax, referring to the empty row. (@paf31)import ... hiding ( ... )
(@andreypopp)psci
now checks imports for validity. (@Bogdanp)Alternative
type class hierarchy was refactored (@joneshf, @garyb)exceptions
library no longer supports throwing exceptions of any type.purescript-transformers
purescript-free
purescript-const
purescript-identity
purescript-lazy
purescript-distributive
purescript-bifunctors
purescript-contravariant
purescript-profunctors
purescript-maps
Published by paf31 about 10 years ago
Published by paf31 about 10 years ago
Published by paf31 about 10 years ago
This incremental release is provided to provide bug fixes and features required to compile the latest core libraries.