jeudi 16 novembre 2017

Is it possible to have an if function use pattern matching in Haskell?

I know that a method that takes a list input can use pattern matching like so:

testingMethod [] = "Blank"
testingMethod (x:xs) = show x

My question is, can I do this with an if function? For example, if I have a function1 that needs to check the pattern of the output from function2, how would I go about doing this? I am looking for something like this:

if (function2 inputInt == pattern((x:xs), [1,2,3])) then

Is this possible to do in haskell?

Aucun commentaire:

Enregistrer un commentaire