cats v0.7.0 Release Notes

  • 2016 August 21

    ๐Ÿ”– Version 0.7.0 is the seventh Cats release, and includes several major rearrangements and changes to names.

    Migration notes

    โšก๏ธ If you're updating from Cats 0.6.0, it's likely that you'll need to make extensive (but mostly mechanical) changes. The following list includes some of the changes that are likely to be necessary for most projects; see the complete list of changes below for more detail.

    • ๐Ÿ‘€ All references to cats.std will need to be changed to cats.instances (#1140). If you're using cats.std.all or the other cats.std objects with wildcard imports, this is likely to be the only change you need to make. If you are importing or referring to instance definitions by name, you'll need to be aware that the naming convention has changed (see #1066, #1068, #1110, and #1122).
    • NonEmptyList and NonEmptyVector are no longer type aliases for OneAnd, so any code using OneAnd to construct or pattern match on these types will need to be changed to use NonEmptyList or NonEmptyVector directly. There are also some API changes; for example, unwrap calls will need to be replaced by toList or toVector, and NonEmptyList(1, 2, 3) is now NonEmptyList.of(1, 2, 3).
    • ๐Ÿšš pureEval has been removed from Applicative (#1234), and has not been replaced, so if you are relying on it for laziness or effect capturing (which wasn't enforced or guaranteed), you'll need to find another approach.
    • All references to NaturalTransformation will need to be replaced by either FunctionK or ~>.
    • 0๏ธโƒฃ The FlatMap type class now has a tailRecM method that is designed to support stack-safe recursive monadic binding. If your monad's flatMap is stack safe, you can implement a stack-safe tailRecM by calling Monad#defaultTailRecM. The stack safety of tailRecM is not enforced, but if your implementation is stack safe, you should also provide an instance of the RecursiveTailRecM marker type class.
    • ๐Ÿ†“ If you are interpreting a free algebra into a context F with foldMap, you'll now need F to have an instance of the RecursiveTailRecM marker type class (in addition to the Monad instance).

    โšก๏ธ If you run into any issues while updating, please get in touch on Gitter.

    ๐Ÿ”„ Changes

    ๐Ÿš€ This release includes a fix for a bug in 0.6.0 (also fixed in 0.6.1):

    • #1062: Order instances for tuples are now lexicographic (instead of only comparing first elements)

    ๐Ÿ›  And other bug fixes:

    • #1096: inj and prj on Inject now work consistently with respect to null

    And some additions:

    • #1289 and #1306: EitherT and improved Either syntax
    • #1280: FlatMap now has a tailRecM method
    • #1280: RecursiveTailRecM marker type class indicating that tailRecM is stack safe
    • #1266: FreeT monad transformer
    • #1225: FunctorFilter and TraverseFilter
    • ๐Ÿ”€ #1121: valueOr and merge for Validated
    • #1188: toValidatedNel for XorT
    • #1127: toTry for Xor
    • #1269: catchNonFatal for ApplicativeError
    • #1130: isEmpty syntax method for Monoid
    • #1167: minimum, maximum, and related helper methods for Foldable and Reducible
    • #1243: distinct on NonEmptyList and NonEmptyVector
    • #1134: cats.syntax.list for ร  la carte list syntax imports
    • #1191: cats.syntax.monoid for ร  la carte Monoid syntax imports
    • #588 and #1063: IdT, the identity monad transformer
    • #1021 and #1221: Nested (represents nested composition of type constructors)
    • #1172: toNested for OptionT and XorT
    • #1102 and #1170: Comparison (represents the result of an Order comparison)
    • #1090: Kleisli.lift
    • #1169: lift, inspect, and related methods for StateT
    • #1114: size for Foldable
    • #1193: reduceLeftM for Reducible
    • #1097: Functor variance helpers (widen for Functor and narrow for Contravariant)
    • #1207: tell for Writer and WriterT, value for Writer
    • #1155: Convenience methods for constructing XorT values
    • ๐Ÿ†“ #1085: runTailRec and foldLeftM for Free
    • #1299: ContravariantCartesian type class

    And some name changes:

    • #1140: cats.std is now cats.instances
    • #1066, #1068, #1110, and #1122: More unique type class instance names
    • #1072: NaturalTransformation is now FunctionK
    • ๐Ÿ†“ #1085: mapSuspension on Free is now compile
    • ๐Ÿ†“ #1111: Free.Gosub is now Free.FlatMapped
    • #1133: Composite* traits for binary type classes are renamed to Composed* for consistency (and are now private)

    And other API changes:

    • #1231: NonEmptyList is now a case class instead of a type alias for a OneAnd
    • #1137: NonEmptyVector is now a value class instead of a type alias for a OneAnd
    • #1267: Overloaded variadic apply on NonEmptyList and NonEmptyVector is now of
    • ๐Ÿšš #1234: Applicative#pureEval has been removed
    • ๐Ÿ‘€ #1202: MonadFilter no longer has a filterM method (see #1225)
    • ๐Ÿ†“ #1075: foldMap on Free now requires a MonadRec instance (instead of simply Monad)
    • ๐Ÿ†“ #1085: Free.suspend no longer requires an Applicative instance
    • ๐Ÿ†“ #1084: Safer toString for Free and FreeApplicative
    • #1100: Simplified constraints for methods on Xor and related types
    • #1171: Prioritization traits are now private

    And many new instances:

    • #1059 and #1147: Monoid, MonadError, and other instances for scala.util.Try
    • #1299: Monad for Tuple2
    • #1211: Contravariant for Eq
    • #1220: Traverse and Comonad for Tuple2
    • #1103: Order, MonadError, and other instances for OptionT
    • #1106: Semigroup and Monoid for XorT
    • #1138: SemigroupK and MonadCombine for StateT
    • #1128 Semigroup and Monoid for Applicative
    • #1049: CoflatMap for WriterT
    • #1076 and #1261: MonadRec instances for Eval, StateT, and Future
    • #1105: Unapply instances for Nested shapes

    ๐ŸŽ And miscellaneous improvements to style and performance:

    • #1079: More consistent type lambdas
    • #1300: Much faster Monoid instances for Map

    ๐Ÿ“š And improvements to the documentation:

    • #1145: Major rearrangements and additions
    • #1136: New chart for symbols
    • #1052: New "Why?" section
    • ๐Ÿ™‹ #1095, #1226, and #1227: New FAQ section
    • #1163: New import guide section
    • #1217, #1223, and #1239: New related projects
    • #1057 and #1157: Copy-paste-friendly code blocks
    • #1104 and #1115: Kitchen-sink imports in example code
    • #1050: Switch to rouge for syntax highlighting in the GitHub Pages site
    • #1119: Fix for contramap signature
    • ๐Ÿ“š #1141 and #1162: Fixes for cats-kernel documentation
    • #1149: Spelling consistency for "type class"
    • ๐Ÿ“š #1183: More documentation about use of Machinist, Simulacrum, and kind-projector
    • ๐Ÿ†“ #1056: Clarification about forgetful functors and the free monad
    • #1131 and #1241: Simplified project structure listings
    • ๐Ÿ“š #1185, #1186, and #1189: Miscellaneous improvements for Traverse documentation

    ๐Ÿ— And the build:

    • #1159: Binary compatibility checking for cats-kernel via MiMa
    • โœ… #1256: More reliable Scala.js testing in Travis CI
    • ๐Ÿ“š #1123: cats-kernel is now included in the API documentation
    • ๐Ÿ“š #1051: Empty Scaladocs for 2.10 to avoid issues macros cause for API documentation generation on 2.10
    • ๐Ÿ‘ #1154: Better POM hygiene: no Scoverage dependency
    • #1153 and #1218: More consistent use of Simulacrum for syntax
    • ๐Ÿ’… #1093: Scalastyle is now aware of shared and Scala.js-specific source files
    • ๐Ÿ’… #1142: Additional formatting rules for Scalastyle
    • ๐Ÿ’… #1099: Type lambda style is now enforced by Scalastyle
    • โšก๏ธ #1258: Version updates for SBT and SBT plugins

    We also welcome Kailuo Wang, Peter Neyens, and Oscar Boykin as new Cats maintainers!