markhibberd/introduction-to-fp-in-scala — pull request #5 by leonardoborges (2014-08-10 05:31:51+00:00)
Title: Fix a few typos and errors in the problem statements and type signatures

Hopefully most changes make sense by themselves. One I feel deserves a little more explanation is in the type hint for the `sequence` function in `Parser.scala`:

As it is it will fail like so

```bash
scala> Parser.sequence(List(Parser.character, Parser.failed(NotEnoughInput), Parser.character)).run("hello")

:14: error: no type parameters for method sequence: (parsers: List[challenge.Parser[A]])challenge.Parser[List[A]] exist so that it can be applied to arguments (List[challenge.Parser[_ <: Char]])
--- because ---
argument expression's type is not compatible with formal parameter type;
found : List[challenge.Parser[_ <: Char]]
required: List[challenge.Parser[?A]]
Parser.sequence(List(Parser.character, Parser.failed(NotEnoughInput), Parser.character)).run("hello")
^
```

But we can type hint the failed parser, after which it works fine:

```bash
scala> Parser.sequence(List(Parser.character, (Parser.failed(NotEnoughInput): Parser[Char]), Parser.character)).run("hello")
= Fail(NotEnoughInput)
```