evilsoft / crocks

A collection of well known Algebraic Data Types for your utter enjoyment.
https://crocks.dev
ISC License
1.59k stars 102 forks source link

Require Monoid Instance for Log Entry When Constructing A Writer #433

Closed evilsoft closed 5 years ago

evilsoft commented 5 years ago

Captains Log

image

This PR is a direct answer to implementing the breaking change as defined in this issue. Before this change we provided the value to be wrapped in the Monoid and the Writer would wrap it for us. This created issues when dealing with empty values on types like Array or other structure-ish type Monoids.

Going forward, each log entry will now have to provide an instance of the Monoid

const MaxWriter =
  Writer(Max)

const oldWay =
  MaxWriter(34, 'string')

const newWay =
  MaxWriter(Max(34), 'string')
coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 803cb20e12d764433004192d42baefba328205ef on breaking/update-writer into 6358b68e802bada4504b8213d8aefd8a24614679 on 0.13.

evilsoft commented 5 years ago

@dalefrancis88 all fixed up. Good 👁

dalefrancis88 commented 5 years ago

image