Releases: purescript/purescript
v0.6.8
Breaking Changes
- The
Num
type class has been refined to allow more interesting instances. TheSemiring
,ModuloSemiring
,Ring
andDivisionRing
classes have been introduced. Most code should continue to compile, sinceNumber
was one of only a handful of instances, but library developers will need to break up theirNum
instances.
Enhancements
- @garyb has improved the readability of
psc-docs
output.
Notes
- All uses of the deprecated
ErrorT
have been replaced withExceptT
and thetransformers
andmtl
dependencies bumped accordingly.
v0.6.7.1
v0.6.7
Enhancements
Scoped Type Variables
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
Rows In Instance Contexts
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
Improved let
bindings in psci
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"
Markdown Support in psc-docs
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.
Bug Fixes
v0.6.6
Breaking Changes
- The syntax of record getters was changed to
_.prop
(@garyb)
Enhancements
-
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]
Bug Fixes
- Newline issues were fixed in executables (@michaelficarra)
v0.6.5
Enhancements
-
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)
Bug Fixes
- Some command line options were fixed in
psc-make
(@paulyoung) - Some module import errors were fixed (@garyb)
- A typechecker bug related to row synonyms was fixed (#795, @paf31)
v0.6.4.1
v0.6.4
v0.6.3
Breaking Changes
Bug Fixes
- Case statement at end of
Eff
block not being executed. (#759, @paf31) - A bug related to dead code elimination was fixed. (@garyb)
- Wildcards can now appear in row endings. (@RossMeikleham)
Enhancements
- There is a new "core functional representation", which will enable certain optimizations, and new features such as rewrite rules. (#710, @garyb)
- Record pattern matches now allow field names to be separated from binders using
:
instead of=
, to match record construction (#760, @leighman) - Some improvements needed for the Pursuit tool (@hdgarrood)
- The lexer was separated from the parser, and now supports explicit comments in the AST. Documentation generated by
psc-docs
now contains any inline comments which precede the corresponding declaration, and generated code preserves the same comments. (@paf31) - PureScript now builds on GHC 7.6.* again. (@dylex)
- Proper names can now contain underscores. (@dylex)
- Several auto-completion improvements and fixes in PSCI. (@vkorablin)
Libraries
- The Prelude now contains a
pureST
function to runST
computations in a pure context. (@KMahoney)
Tools
- The Pursuit tool now runs on the community server, and integrates with Bower. Libraries can be added by submitting a pull request. (@hdgarrood)
v0.6.2
Breaking Changes
-
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.
Enhancements
- Use
optparse-applicative
instead ofcmdtheline
(@anthoq88)
Libraries
- Move
STArray
out of Prelude. (@paf31)