
You can store both values, a function and a string representation, in a
predicate:
data Predicate = Predicate (a -> Bool) String
And write corresponding Show instance to show string.
On Wed, Dec 23, 2015 at 2:55 PM, martin
Hello all,
in my program, I do stuff with predicates (a->Bool). For the most part this representation is just fine, but at the very end I need to convert a resulting predicate into a String so I can write it to a file.
Wenn I represent my predicates as Lists or Sets, then this is doable and I am tempted to do it this way. The only other option I could come up with was to have a representation of "everything", which would in my case be large (10^8) but finite. Then I could construct a List or a Set at the very end, as [x | x<-everything, p x] without having explicit sets in the intermediate steps.
I cannot see any other option, but I thought I better ask. _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners