thomashoneyman / purescript-halogen-realworld

Exemplary real world application built with PureScript + Halogen
https://thomashoneyman.com/guides/real-world-halogen
MIT License
792 stars 86 forks source link

Build Fails when I update to the latest package sets: Error found: in module Conduit.Data.Profile #123

Closed harryprayiv closed 9 months ago

harryprayiv commented 9 months ago

When I attempt to update the package sets to the latest (https://github.com/purescript/package-sets/releases/download/psc-0.15.14-20240118/packages.dhall), I get the following error:

`[ 1 of 24] Compiling Conduit.Data.Profile Error found: in module Conduit.Data.Profile at src/Data/Profile.purs:26:20 - 26:28 (line 26, column 20 - line 26, column 28)

Cannot import value mapCodec from module Data.Codec It either does not exist or the module does not export it.`

This is obviously because the Data.Codec module was massively simplified. I attempted to fix it but it was far beyond my current skill level. I'd like to use the latest package set to build this project. If possible, I'd love to help refactor this application to take advantage of the latest package sets. Thanks for sharing this super-important example for the Purescript ecosystem.

thomashoneyman commented 9 months ago

Fortunately it's not too hard! You can replace mapCodec by inserting calls to decode / encode and constructing a new basic codec, like this:

-authorCodec mbUsername = CA.mapCodec to from codec
+authorCodec mbUsername = CA.codec' (to <=< CA.decode codec) (CA.encode codec <<< from)
thomashoneyman commented 9 months ago

I went ahead and updated this repo to a new package set and to use the new spago@next releases. Thanks for the reminder!

harryprayiv commented 9 months ago

Thanks for the quick fix! I'm having such a great time putting all of my energy into the Purescript ecosystem; thankful to be able to stand on the shoulders of generous giants like you and the rest of Purescript's contributors.

thomashoneyman commented 9 months ago

Welcome! Enjoy the journey!