purescript v0.13.3 Release Notes
Release Date: 2019-08-18 // over 4 years ago-
โจ Enhancements
Eliminate empty type class dictionaries in generated code (#2768, @LiamGoodacre)
๐ Empty type class dictionaries โ dictionaries which do not contain any type class member implementations at runtime โ are often used to provide evidence at compile-time to justify that a particular operation will not fail; for example,
Prim.Row.Cons
can be used to justify that we can expect a record to contain a particular field with a particular type. Unfortunately, constructing empty dictionaries can be costly, especially in more complex scenarios such as type-level programming. This release implements a new optimization which avoids the need to build empty dictionaries at runtime by instead insertingundefined
into the generated code. This optimization can both reduce code size and improve performance in certain contexts.๐ Render doc-comments for data constructors and type class members in HTML documentation (#3507, @marcosh)
๐ Documentation comments for data constructors and type class members are now picked up by
purs docs
, and will soon start appearing in Pursuit too. For example:-- | Doc-comments like this one were always rendered in Pursuitdata Maybe a =-- | Now this one (for the Just constructor) will be rendered too= Just a-- | And this one (for Nothing) | Nothing-- | Doc-comments like this one were always rendered in Pursuitclass Eq a where-- | Now this one (for the `eq` method) will be rendered tooeq :: a -\> a -\> Boolean
๐ Show diffs of rows in errors and hints (#3392, @dariooddenino)
In type mismatches between rows, we now elide common labels so that the problem is easier to identify. For example, consider the following code, which has a type error due to the types of the
b
fields in the two records not matching:foo = { a: 1, b: "hi", c: 3, d: 4, e: 5 } bar = { a: 1, b: 2, c: 3, d: 4, e: 5 } baz = [foo, bar]
Previously, the type error would include the entirety of each record type:
Could not match type String with type Int while trying to match type ( a :: Int , b :: String , c :: Int , d :: Int , e :: Int ) with type ( a :: Int , b :: Int , c :: Int , d :: Int , e :: Int )
This can become quite difficult to read in the case of large record types. Now, we get this:
Could not match type String with type Int while trying to match type ( b :: String ... ) with type ( b :: Int ... )
๐ Bug fixes
โ Remove more dead code in
purs bundle
(#3551, @rhendric)๐ The dead code elimination in
purs bundle
now no longer incorrectly considers declarations to be used in the presence of local variables which happen to share their names, and is therefore able to remove these declarations when they are unused.๐ Fix parsing of comma-separated guards in let statements (#3713, @natefaubion)
๐ The 0.13 parser would previously choke on guards separated by commas in let statements within do/ado blocks, such as
test = adolet foo | bar , baz = 42 | otherwise = 100in foo
๐ This has now been fixed.
Other
- โ Add placeholder purs.bin to fix npm installs (#3695, @hdgarrood)
- ๐จ Refactor and simplify BuildPlan a little (#3699, @hdgarrood)
- โก๏ธ Update link to partial type class guide in error message hints (#3717, @alextes)