I have an algebraic data type like:
data Toll = Vok Int Bool | Bok Int | Cokd String Char
and another function
getVal :: Int -> Toll
getVal 1 = Cokd "hello" 'c'
getVal _ = Bok 12
I want to call getVal in some function and extract the arguments of Cokd (if the answer was of type Cokd) (maybe using pattern matching).
can I do like:
hello :: Int -> Bool
hello x = if st == "hell" then True else False
where (Cokd st ch) = getVal x
I cannot use monads.
How to do that?