frasertweedale/hs-jose

replace (most) occurrences of String with Text

frasertweedale opened this issue · 4 comments

replace (most) occurrences of String with Text

Hey @frasertweedale is there a general pattern you want here for getting rid of string?
Replace it everywhere that is possible?

Pretty much. I changed a bunch of String to Text in a commit a little while ago so I think that might have been most of the "easy" ones. Some places (i.e. parser errors) cannot be changed from String unfortunately.

Having a quick glance, places using String are:

  • AlgorithmMismatch constructor
  • CompactDecodeError constructor
  • JSONDecodeError constructor (used for aeson decode errors; leave as string)
  • internally in the URI type (can't do much about that, besides stop using that lib. I can live with it, but I'm open to suggestions for a better lib)
  • JWTClaimsSetDecodeError (a glorified aeson decode error, which is a string, so can't do much about that)

I would like to change AlgorithmMismatch and CompactDecodeError, but I will make better types for them, not merely to switch to Text. Apart from them, pretty much everything else that could be done (in a straightforward way), has been done, so I'll close this issue and open a couple others.