2006/10/10, David Roundy <droundy@darcs.net>:

>declassify :: Secret a -> String -> Maybe a
>declassify (Secret pw x) pw' | pw' == pw = Just x
>declassify (Secret _ _) _ = Nothing

Why does this works? "Yet Another Haskell Tutorial" teaches that pattern matching occurs at one stage and guard processing at other, and that there's no back (page 94).

--
Felipe.