Question: After implementing a simple parser in Haskell, I ran the following example code to test my parer.

```
example = fst $ (\(Just x)->x) $ parse (tokenize "assign x := not(and(true, false)); print x; assign a := not(and(x, x)); print a; end;") :: Stmt

```

and it returns **Exception: Parse.hs:93:18-29: Non-exhaustive patterns in lambda**

What am I doing wrong here that might be the cause of this error?

Answer: 
You're ending up feeding `Nothing` into the lambda `(\(Just x) -> x)`, causing a non-exhaustive pattern match error. Instead, use the `maybe` function:

```
default_value :: Stmt
default_value = ???

maybe default_value fst $ parse (tokenize "...") :: Stmt

```
In your lambda `(\(Just x)->x)` you need to account for the possibility that its argument may be `Nothing`. 

Try this: 

```
hdlr (Just x) = x
hdlr Nothing = error "Failed"

example = fst $ hdlr $ parse (tokenize "assign x := not(and(true, false)); print x; assign a := not(and(x, x)); print a; end;") :: Stmt

```