Skip to content

Wrong types in Example #36

Closed
Closed
@Abhiroop

Description

@Abhiroop

Tutorials : Chapter 3

In the first example of Selective Receive this line won't typecheck:

mapM_ (say . show) [first, second, third]

because the types of first, second and third are not the same.

first :: String
second :: Maybe String -- (corrected in PR#35)
third :: ProcessId

A possible simple solution would be to manually use

(say.show) first
(say.show) second
(say.show) third

Or otherwise construct a heterogenous lists(using GADTs or existential quantification) and then use mapM_ which seems cumbersome and unnecessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions