[General boards] [Winter 2019 courses] [Fall 2018 courses] [Summer 2018 courses] [Older or newer terms]

Convert state monad parameterized value to the actual value?


#1

I have a function which returns a value of type ‘StateT [Int] Data.Functor.Identity.Identity Bool’, but I’m not sure how to use this value as if it were just a boolean (such as using the value with || or &&).

How would I go about converting this value to a regular Boolean?


#2

Cannot be done. Unless you provide an initial state, and take a look at evalState.

Should be obvious in retrospect. The computer doesn’t know what initial value you want.