lambda - Does Haskell provide an idiom for pattern matching against many possible data constructors? -
working on haskell project, i'm dealing event data type fsnotify package. constructors event all: added filepath utctime modified filepath utctime removed filepath utctime in code, i'm interested in extracting filepath event , doing same action regardless of type constructor; because of this, i'm tempted make lambda. unfortunately, code suffers reduced readability when drop case expression lambda pattern match against 3 cases; there built-in idiom extract filepath in 1 expression without having manually pattern match, given relative homogeneity of type constructors? i've tried passing expression anonymous function in call watchdir action: wm <- startmanager sw <- watchdir wm "." (\_ -> true) (\(_ f t) -> putstrln f) but, predictably, don't-care value in lambda's pattern match causes parse error. the simplest way reflect homogenity of alternatives in type declaration, instead of observing it: data action ...