Posts

Showing posts from December 11, 2018

Is Pattern Matching as expressive as Case Expression in Haskell?

Image
up vote 1 down vote favorite Nomenclature The term expressive in the question shall bear the same meaning as in the following sentence: A Turing Machine is as expressive as Lambda Calculus. Introduction While learning Haskell, I had noticed that there are 2 ways to achieve the same effect, namely Pattern Matching and Case Expression. For example, -- Pattern Matching not True = False not False = True -- Case Expression not x = case x of True -> False False -> True I am also fully aware that Pattern Matching is actually a form of syntax sugar that will be compiled into Case Expression. Therefore, we can be very sure that every Pattern Matching expression can be converted to Case Expression. Question So, this is my question: Is the following statement true? Every Case Expres