11 Nov
2010
11 Nov
'10
7:18 p.m.
On Thursday 11 November 2010 18:45:43, C K Kashyap wrote:
Is there a way out? What I need to do is implement a protocol - so it would be nice to write a case expression with patters being symbolic.
Guards? case expr of res | res == v1 -> "One" | res == v2 -> "Two" _ -> error "Three" Or perhaps a little preprocessor abuse might help. {-# LANGUAGE CPP #-} #define V1 1 #define V2 2 case expr of V1 -> "One" V2 -> "Two" _ -> error "Three"