purescript-book icon indicating copy to clipboard operation
purescript-book copied to clipboard

Typos and feedback

Open tbenst opened this issue 8 years ago • 2 comments

Really great read so far!

Edit: Figured it'd be easier just to update one issue rather than make a new one for each item

5.17

This is the first section I found a bit confusing. It doesn't seem related to pattern matching at first and a few concepts, emptyBounds, shapeBounds, and \/, were opaque until I looked at the Exercise code.

Perhaps include more code from https://github.com/paf31/purescript-book/blob/master/exercises/chapter5/src/Data/Picture.purs?

6.8

Might be nice to introduce uncons or share the motivation--I'm guessing this is to avoid the unsafePartials that we've seen until now. e.g.

main :: forall e. Eff (console :: CONSOLE | e) Unit
main = void do
    let test = String.uncons "hello world"
    case test of
        Just y -> log $ show y.head
        Nothing -> pure unit

6.9

This functional dependency tells the compiler that there is a function from stream types to (unique) element types, so if the compiler knows the stream type, then it can commit to the element type.

This seems at odds with instance streamArray :: Stream (Array a) a, where the stream does not give us a unique element.

Typos / small suggestions

  • 4.4 the dependency purescript-arrays is now needed to import Data.Array
  • 6.2 small typo in (the letter Â) after src/Data/Hashable.purs.
  • 6.9 I assume that _.head is equivalent to \x -> x.head, but would be nice to know
  • 6.11 Perhaps explicitly repeat class Eq a <= Ord a to clarify

tbenst avatar Feb 17 '17 02:02 tbenst

7.11

A typo in sequence :: forall a f. Applicative m => t (f a) -> f (t a). m should be f.

harryxp avatar Jul 07 '17 20:07 harryxp

from https://github.com/paf31/purescript-book/blob/master/text/chapter7.md#applicative-validation-1 double commas at the start and end of some lines:

Person
  { firstName: "John",
  , lastName: "Smith",
  , address: Address
      { street: "123 Fake St."
      , city: "FakeTown"
      , state: "CA"
      },
  , phones: [ PhoneNumber
                { type: HomePhone
                , number: "555-555-5555"
                }
            , PhoneNumber
                { type: CellPghone
                , number: "555-555-0000"
                }
            ]
  }

ghost avatar Jul 20 '17 11:07 ghost