[Haskell-cafe] a monad for secret information

Seth Gordon sethg at ropine.com
Tue Oct 10 08:41:06 EDT 2006

Cale Gibbard wrote:
> Why not just:
> secret :: a -> Classification String a
> secret = Classification "xyzzy"
> The password string isn't part of the type, it doesn't even
> necessarily exist at compile time. You might have just got confused
> between type and data constructors for a moment.

But now I want to be able to process the secret monadically:

mySecret =
  secret "Jimmy Hoffa is buried under the 50-yd line in the Meadowlands"

do secretData <- mySecret
   return (length secretData)

How do I define "return" so that it will put the password back, and how
do I define "(>>=)" so that the password won't be accessible within the

More information about the Haskell-Cafe mailing list