Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A fortune-mod clone
Branch: master
Failed to load latest commit information.
cruft moved a little utility to scrape from junkbox repo to this one
data Changed index file extension to .ix
src add FlexibleInstances to fix 7.10 build
.gitignore initializing repository
.travis.yml oops, did not intend to commit that last one... it was *supposed* to … A reasonable attempt at attribution for compilation of quote databases A reasonable attempt at attribution for compilation of quote databases updating travis config
Setup.lhs Initial import of a fortune-mod clone
TODO minor cleanup and simplifications.

misfortune Build Status

This is a fortune-mod clone. In addition to the features generally expected of a fortune program, this can be used as a Haskell library (import Data.Fortune) and also supports UTF-8 fortune files, configurable search paths, automatic merging of fortune databases with the same name (so you can have a local fortunes folder that just adds to existing fortune databases), filtering fortunes by line lengths, and a "print fortune matching regex" mode (instead of just "print all fortunes matching regex" mode).


Most of the command-line flags from fortune work with misfortune as well. To just print a fortune, run:


To index a new fortune file (or update the index on an existing one), run:

misfortune-strfile path/to/file

To use the fortune API in your Haskell programs:

import Data.Fortune
import qualified Data.Text as T

main = do
    f <- openFortuneFile "pangrams" '%' True

    appendFortune f (T.pack "The quick brown fox jumps over the lazy dog.")
    appendFortune f (T.pack "Quick blowing zephyrs vex daft Jim.")

    closeFortuneFile f

    putStrLn =<< randomFortune ["pangrams"]

This example will create or append to a file "pangrams" in the working directory, and create or update the corresponding index file "pangrams.dat". It then closes that file and requests a random fortune from all databases named "pangrams" in the search path - so it will either print one of the two just written or one found in another "pangrams" file. Every eligible fortune is equally likely.


Get the current release from Hackage:

cabal install misfortune

Or build the latest version from git:

git clone
cd misfortune
cabal install
Something went wrong with that request. Please try again.