|
|
|
|
|
by vutekst
4326 days ago
|
|
> Even in Haskell values must be tagged with types, and the type tags are inspected at runtime. This does not fit my understanding of pattern matching in Haskell. Say you are matching over a value of type `Maybe String`. The type of the value is always `Maybe String`, it's just that its value might be `Just "foo"` or `Nothing :: Maybe String`. It is not to my knowledge tagged with type information at runtime in a compiled program, merely value information. The different values an ADT disjunction can take on all have the same type as each other. > Otherwise, pattern matching wouldn't work (pattern matching is always based on type reflection). What about pattern matching a String against a series of literal values? I don't see how this is based on type reflection, merely inspection of values. |
|