Relative Content

Tag Archive for pattern-matching

Haskell’s ‘:’ operator

I am currently studying about pattern matching in Haskell from here. The author gives an example of the implementation of “head” function (which returns the first element of a list) as following:

Haskell’s ‘:’ operator

I am currently studying about pattern matching in Haskell from here. The author gives an example of the implementation of “head” function (which returns the first element of a list) as following:

Haskell’s ‘:’ operator

I am currently studying about pattern matching in Haskell from here. The author gives an example of the implementation of “head” function (which returns the first element of a list) as following:

Haskell’s ‘:’ operator

I am currently studying about pattern matching in Haskell from here. The author gives an example of the implementation of “head” function (which returns the first element of a list) as following:

Why can’t the Scala compiler give pattern matching warning for nonsealed classes/traits?

If I use an unsealed trait or abstract class in Scala and then use pattern matching, I wonder, does the compiler not know at compile time for this particular patternmatch what possible implementations of this trait/class are available? So, if it does, could it not give pattern match warnings even though that the trait/abstract class is not sealed because he knows which types could be used, by checking all the possible dependencies/imports?

Pattern Matching on Request Body for Routing an HTTP Request

In an HTTP application, I think about routing requests based not only on the path, but also based on the request body. For an example, think about the following two different body schemas for a PUT request against an /orders/{id} endpoint: