# Misunderstanding Types

**URL:** <https://discourse.haskell.org/t/misunderstanding-types/919>\
**Category:** Uncategorized\
**Created:** [October 8, 2019, 1:55pm UTC](https://discourse.haskell.org/t/misunderstanding-types/919 "2019-10-08T13:55:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PoroDev](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/porodev/32/611_2.png) [@PoroDev](https://discourse.haskell.org/u/PoroDev)\
**Post date:** [October 8, 2019, 1:55pm UTC](https://discourse.haskell.org/t/misunderstanding-types/919/1 "2019-10-08T13:55:30Z")

</div>

Hey, here is the code I try to understand but I don’t know how to consider the P here, can someone help ?

```
data Parser b a = P (b -> [(a, b)])

parse :: Parser b a -> b -> [(a, b)]
parse (P p) inp = p inp`
```

---

<div class="post-metadata">

**Author:** ![f-a](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/f-a/32/2740_2.png) [@f-a](https://discourse.haskell.org/u/f-a)\
**Post date:** [October 8, 2019, 3:51pm UTC](https://discourse.haskell.org/t/misunderstanding-types/919/2 "2019-10-08T15:51:38Z")

</div>

Like a type synonym!

`P` adds nothing, but reading `Parser b a` is easier on the  
eyes than `(b -> [(a, b)])`.

---

<div class="post-metadata">

**Author:** ![PoroDev](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/porodev/32/611_2.png) [@PoroDev](https://discourse.haskell.org/u/PoroDev)\
**Post date:** [October 8, 2019, 4:29pm UTC](https://discourse.haskell.org/t/misunderstanding-types/919/3 "2019-10-08T16:29:20Z")

</div>

So here the “(P p) is a parser applied to inp giving " p inp`” ?

---

<div class="post-metadata">

**Author:** ![f-a](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/f-a/32/2740_2.png) [@f-a](https://discourse.haskell.org/u/f-a)\
**Post date:** [October 8, 2019, 6:19pm UTC](https://discourse.haskell.org/t/misunderstanding-types/919/4 "2019-10-08T18:19:54Z")

</div>

Yep! (now let me add more characters so Discourse won’t complain)
