How can I print a list or something in haskell at every call for example :
funct a list = funct (a + 1) (a : list)
print list here ??????? but how ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For debugging, there’s
where
trace :: String -> a -> a. It usesunsafePerformIOunder the hood, so it’s evil and only for debugging.Be aware that due to lazy evaluation, the debugging output may appear in surprising order and interleaved with the output the program would normally generate.
With
I get
as expected.