up-to-date-real-world-haskell icon indicating copy to clipboard operation
up-to-date-real-world-haskell copied to clipboard

Some Problems in Chapter 14

Open pdcxs opened this issue 4 years ago • 0 comments
trafficstars

I follow the codes in chapter 14 and find some little problems.

  1. charClass_wordy defined but not used, I think maybe the charClass function should be modified as following:
charClass (']':cs) = (']':) <$> globToRegex' cs
charClass (c:cs) = (c:) <$> charClass_wordy cs
  1. According to monad fail, from GHC 8.8+, the fail function will not be supported. I suggest change the fail function to error or other implementation.

  2. charClass_wordy also lacks a matching form, which should be added as follows:

charClassWordy "" = 
    error "No more input"

pdcxs avatar Nov 28 '20 13:11 pdcxs