;;; haskell-ref.el --- quick access to the haskell reference

;; Author: Mark Triggs <mst@dishevelled.net>

;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;; Commentary:

;; Makes for quick access to the Haskell Reference provided by ZVON. This can
;; be downloaded from
;; http://zvon.org/download2.php/haskell?title=Haskell+reference at the time of
;; writing.

;; Use M-x haskell-reference-lookup to look up functions or better yet, bind
;; it to a key in haskell-mode-map with code like:

;; (eval-after-load "haskell-mode"
;;   `(progn
;;      (require 'haskell-ref)
;;       (define-key haskell-mode-map (kbd "C-c C-d")
;;         'haskell-reference-lookup)))

;;; Code:

(defvar *haskell-reference-location*
  (concat "file:" (expand-file-name "~/docs/reference/haskell_reference")))


(defvar *haskell-reference-functions*
  '(("abs" . "Outputprelude/abs_f.html")
    ("accum" . "Outputarray/accum_f.html")
    ("accumArray" . "Outputarray/accumArray_f.html")
    ("acos" . "Outputprelude/acos_f.html")
    ("acosh" . "Outputprelude/acosh_f.html")
    ("addToClockTime" . "Outputtime/addToClockTime_f.html")
    ("all" . "Outputprelude/all_f.html")
    ("and" . "Outputprelude/and_f.html")
    ("any" . "Outputprelude/any_f.html")
    ("ap" . "Outputmonad/ap_f.html")
    ("appendFile" . "Outputprelude/appendFile_f.html")
    ("approxRational" . "Outputratio/approxRational_f.html")
    ("array" . "Outputarray/array_f.html")
    ("asin" . "Outputprelude/asin_f.html")
    ("asinh" . "Outputprelude/asinh_f.html")
    ("assocs" . "Outputarray/assocs_f.html")
    ("asTypeOf" . "Outputprelude/asTypeOf_f.html")
    ("atan" . "Outputprelude/atan_f.html")
    ("atan2" . "Outputprelude/atan2_f.html")
    ("atanh" . "Outputprelude/atanh_f.html")
    ("bounds" . "Outputarray/bounds_f.html")
    ("bracket" . "Outputio/bracket_f.html")
    ("bracket_" . "Outputio/bracket__f.html")
    ("break" . "Outputprelude/break_f.html")
    ("calendarTimeToString" . "Outputtime/calendarTimeToString_f.html")
    ("catch" . "Outputprelude/catch_f.html")
    ("catMaybes" . "Outputmaybe/catMaybes_f.html")
    ("ceiling" . "Outputprelude/ceiling_f.html")
    ("chr" . "Outputchar/chr_f.html")
    ("cis" . "Outputcomplex/cis_f.html")
    ("compare" . "Outputprelude/compare_f.html")
    ("concat" . "Outputprelude/concat_f.html")
    ("concatMap" . "Outputprelude/concatMap_f.html")
    ("conjugate" . "Outputcomplex/conjugate_f.html")
    ("const" . "Outputprelude/const_f.html")
    ("cos" . "Outputprelude/cos_f.html")
    ("cosh" . "Outputprelude/cosh_f.html")
    ("cpuTimePrecision" . "Outputcputime/cpuTimePrecision_f.html")
    ("createDirectory" . "Outputdirectory/createDirectory_f.html")
    ("curry" . "Outputprelude/curry_f.html")
    ("cycle" . "Outputprelude/cycle_f.html")
    ("decodeFloat" . "Outputprelude/decodeFloat_f.html")
    ("defaultTimeLocale" . "Outputlocale/defaultTimeLocale_f.html")
    ("delete" . "Outputlist/delete_f.html")
    ("deleteBy" . "Outputlist/deleteBy_f.html")
    ("denominator" . "Outputratio/denominator_f.html")
    ("diffClockTimes" . "Outputtime/diffClockTimes_f.html")
    ("digitToInt" . "Outputchar/digitToInt_f.html")
    ("div" . "Outputprelude/div_f.html")
    ("divMod" . "Outputprelude/divMod_f.html")
    ("doesDirectoryExist" . "Outputdirectory/doesDirectoryExist_f.html")
    ("doesFileExist" . "Outputdirectory/doesFileExist_f.html")
    ("drop" . "Outputprelude/drop_f.html")
    ("dropWhile" . "Outputprelude/dropWhile_f.html")
    ("either" . "Outputprelude/either_f.html")
    ("elem" . "Outputprelude/elem_f.html")
    ("elemIndex" . "Outputlist/elemIndex_f.html")
    ("elemIndices" . "Outputlist/elemIndices_f.html")
    ("elems" . "Outputarray/elems_f.html")
    ("encodeFloat" . "Outputprelude/encodeFloat_f.html")
    ("enumFrom" . "Outputprelude/enumFrom_f.html")
    ("enumFromThen" . "Outputprelude/enumFromThen_f.html")
    ("enumFromThenTo" . "Outputprelude/enumFromThenTo_f.html")
    ("enumFromTo" . "Outputprelude/enumFromTo_f.html")
    ("error" . "Outputprelude/error_f.html")
    ("even" . "Outputprelude/even_f.html")
    ("executable" . "Outputdirectory/executable_f.html")
    ("exitFailure" . "Outputsystem/exitFailure_f.html")
    ("exitWith" . "Outputsystem/exitWith_f.html")
    ("exp" . "Outputprelude/exp_f.html")
    ("exponent" . "Outputprelude/exponent_f.html")
    ("fail" . "Outputprelude/fail_f.html")
    ("filter" . "Outputprelude/filter_f.html")
    ("filterM" . "Outputmonad/filterM_f.html")
    ("find" . "Outputlist/find_f.html")
    ("findIndex" . "Outputlist/findIndex_f.html")
    ("findIndices" . "Outputlist/findIndices_f.html")
    ("flip" . "Outputprelude/flip_f.html")
    ("floatDigits" . "Outputprelude/floatDigits_f.html")
    ("floatRadix" . "Outputprelude/floatRadix_f.html")
    ("floatRange" . "Outputprelude/floatRange_f.html")
    ("floatToDigits" . "Outputnumeric/floatToDigits_f.html")
    ("floor" . "Outputprelude/floor_f.html")
    ("fmap" . "Outputprelude/fmap_f.html")
    ("foldl" . "Outputprelude/foldl_f.html")
    ("foldl1" . "Outputprelude/foldl1_f.html")
    ("foldM" . "Outputmonad/foldM_f.html")
    ("foldr" . "Outputprelude/foldr_f.html")
    ("foldr1" . "Outputprelude/foldr1_f.html")
    ("formatCalendarTime" . "Outputtime/formatCalendarTime_f.html")
    ("fromEnum" . "Outputprelude/fromEnum_f.html")
    ("fromInteger" . "Outputprelude/fromInteger_f.html")
    ("fromIntegral" . "Outputprelude/fromIntegral_f.html")
    ("fromJust" . "Outputmaybe/fromJust_f.html")
    ("fromMaybe" . "Outputmaybe/fromMaybe_f.html")
    ("fromRat" . "Outputnumeric/fromRat_f.html")
    ("fromRational" . "Outputprelude/fromRational_f.html")
    ("fst" . "Outputprelude/fst_f.html")
    ("gcd" . "Outputprelude/gcd_f.html")
    ("genericDrop" . "Outputlist/genericDrop_f.html")
    ("genericIndex" . "Outputlist/genericIndex_f.html")
    ("genericLength" . "Outputlist/genericLength_f.html")
    ("genericReplicate" . "Outputlist/genericReplicate_f.html")
    ("genericSplitAt" . "Outputlist/genericSplitAt_f.html")
    ("genericTake" . "Outputlist/genericTake_f.html")
    ("getArgs" . "Outputsystem/getArgs_f.html")
    ("getChar" . "Outputprelude/getChar_f.html")
    ("getClockTime" . "Outputtime/getClockTime_f.html")
    ("getContents" . "Outputprelude/getContents_f.html")
    ("getCPUTime" . "Outputcputime/getCPUTime_f.html")
    ("getCurrentDirectory" . "Outputdirectory/getCurrentDirectory_f.html")
    ("getDirectoryContents" . "Outputdirectory/getDirectoryContents_f.html")
    ("getEnv" . "Outputsystem/getEnv_f.html")
    ("getLine" . "Outputprelude/getLine_f.html")
    ("getModificationTime" . "Outputdirectory/getModificationTime_f.html")
    ("getPermissions" . "Outputdirectory/getPermissions_f.html")
    ("getProgName" . "Outputsystem/getProgName_f.html")
    ("getStdGen" . "Outputrandom/getStdGen_f.html")
    ("getStdRandom" . "Outputrandom/getStdRandom_f.html")
    ("group" . "Outputlist/group_f.html")
    ("groupBy" . "Outputlist/groupBy_f.html")
    ("guard" . "Outputmonad/guard_f.html")
    ("hClose" . "Outputio/hClose_f.html")
    ("head" . "Outputprelude/head_f.html")
    ("hFileSize" . "Outputio/hFileSize_f.html")
    ("hFlush" . "Outputio/hFlush_f.html")
    ("hGetBuffering" . "Outputio/hGetBuffering_f.html")
    ("hGetChar" . "Outputio/hGetChar_f.html")
    ("hGetContents" . "Outputio/hGetContents_f.html")
    ("hGetLine" . "Outputio/hGetLine_f.html")
    ("hGetPosn" . "Outputio/hGetPosn_f.html")
    ("hIsClosed" . "Outputio/hIsClosed_f.html")
    ("hIsEOF" . "Outputio/hIsEOF_f.html")
    ("hIsOpen" . "Outputio/hIsOpen_f.html")
    ("hIsReadable" . "Outputio/hIsReadable_f.html")
    ("hIsSeekable" . "Outputio/hIsSeekable_f.html")
    ("hIsWritable" . "Outputio/hIsWritable_f.html")
    ("hLookAhead" . "Outputio/hLookAhead_f.html")
    ("hPrint" . "Outputio/hPrint_f.html")
    ("hPutChar" . "Outputio/hPutChar_f.html")
    ("hPutStr" . "Outputio/hPutStr_f.html")
    ("hPutStrLn" . "Outputio/hPutStrLn_f.html")
    ("hReady" . "Outputio/hReady_f.html")
    ("hSeek" . "Outputio/hSeek_f.html")
    ("hSetBuffering" . "Outputio/hSetBuffering_f.html")
    ("hSetPosn" . "Outputio/hSetPosn_f.html")
    ("hWaitForInput" . "Outputio/hWaitForInput_f.html")
    ("id" . "Outputprelude/id_f.html")
    ("imagPart" . "Outputcomplex/imagPart_f.html")
    ("index" . "Outputix/index_f.html")
    ("indices" . "Outputarray/indices_f.html")
    ("init" . "Outputprelude/init_f.html")
    ("inits" . "Outputlist/inits_f.html")
    ("inRange" . "Outputix/inRange_f.html")
    ("insert" . "Outputlist/insert_f.html")
    ("insertBy" . "Outputlist/insertBy_f.html")
    ("interact" . "Outputprelude/interact_f.html")
    ("intersect" . "Outputlist/intersect_f.html")
    ("intersectBy" . "Outputlist/intersectBy_f.html")
    ("intersperse" . "Outputlist/intersperse_f.html")
    ("intToDigit" . "Outputchar/intToDigit_f.html")
    ("ioeGetErrorString" . "Outputio/ioeGetErrorString_f.html")
    ("ioeGetFileName" . "Outputio/ioeGetFileName_f.html")
    ("ioeGetHandle" . "Outputio/ioeGetHandle_f.html")
    ("ioError" . "Outputprelude/ioError_f.html")
    ("isAlpha" . "Outputchar/isAlpha_f.html")
    ("isAlphaNum" . "Outputchar/isAlphaNum_f.html")
    ("isAlreadyExistsError" . "Outputio/isAlreadyExistsError_f.html")
    ("isAlreadyInUseError" . "Outputio/isAlreadyInUseError_f.html")
    ("isAscii" . "Outputchar/isAscii_f.html")
    ("isControl" . "Outputchar/isControl_f.html")
    ("isDenormalized" . "Outputprelude/isDenormalized_f.html")
    ("isDigit" . "Outputchar/isDigit_f.html")
    ("isDoesNotExistError" . "Outputio/isDoesNotExistError_f.html")
    ("isEOF" . "Outputio/isEOF_f.html")
    ("isEOFError" . "Outputio/isEOFError_f.html")
    ("isFullError" . "Outputio/isFullError_f.html")
    ("isHexDigit" . "Outputchar/isHexDigit_f.html")
    ("isIEEE" . "Outputprelude/isIEEE_f.html")
    ("isIllegalOperation" . "Outputio/isIllegalOperation_f.html")
    ("isInfinite" . "Outputprelude/isInfinite_f.html")
    ("isJust" . "Outputmaybe/isJust_f.html")
    ("isLatin1" . "Outputchar/isLatin1_f.html")
    ("isLower" . "Outputchar/isLower_f.html")
    ("isNaN" . "Outputprelude/isNaN_f.html")
    ("isNegativeZero" . "Outputprelude/isNegativeZero_f.html")
    ("isNothing" . "Outputmaybe/isNothing_f.html")
    ("isOctDigit" . "Outputchar/isOctDigit_f.html")
    ("isPermissionError" . "Outputio/isPermissionError_f.html")
    ("isPrefixOf" . "Outputlist/isPrefixOf_f.html")
    ("isPrint" . "Outputchar/isPrint_f.html")
    ("isSpace" . "Outputchar/isSpace_f.html")
    ("isSuffixOf" . "Outputlist/isSuffixOf_f.html")
    ("isUpper" . "Outputchar/isUpper_f.html")
    ("isUserError" . "Outputio/isUserError_f.html")
    ("iterate" . "Outputprelude/iterate_f.html")
    ("ixmap" . "Outputarray/ixmap_f.html")
    ("join" . "Outputmonad/join_f.html")
    ("last" . "Outputprelude/last_f.html")
    ("lcm" . "Outputprelude/lcm_f.html")
    ("length" . "Outputprelude/length_f.html")
    ("lex" . "Outputprelude/lex_f.html")
    ("lexDigits" . "Outputnumeric/lexDigits_f.html")
    ("lexLitChar" . "Outputchar/lexLitChar_f.html")
    ("liftM" . "Outputmonad/liftM_f.html")
    ("liftM2" . "Outputmonad/liftM2_f.html")
    ("liftM3" . "Outputmonad/liftM3_f.html")
    ("liftM4" . "Outputmonad/liftM4_f.html")
    ("liftM5" . "Outputmonad/liftM5_f.html")
    ("lines" . "Outputprelude/lines_f.html")
    ("listArray" . "Outputarray/listArray_f.html")
    ("listToMaybe" . "Outputmaybe/listToMaybe_f.html")
    ("log" . "Outputprelude/log_f.html")
    ("logBase" . "Outputprelude/logBase_f.html")
    ("lookup" . "Outputprelude/lookup_f.html")
    ("magnitude" . "Outputcomplex/magnitude_f.html")
    ("map" . "Outputprelude/map_f.html")
    ("mapAccumL" . "Outputlist/mapAccumL_f.html")
    ("mapAccumR" . "Outputlist/mapAccumR_f.html")
    ("mapAndUnzipM" . "Outputmonad/mapAndUnzipM_f.html")
    ("mapM" . "Outputprelude/mapM_f.html")
    ("mapM_" . "Outputprelude/mapM__f.html")
    ("mapMaybe" . "Outputmaybe/mapMaybe_f.html")
    ("max" . "Outputprelude/max_f.html")
    ("maxBound" . "Outputprelude/maxBound_f.html")
    ("maximum" . "Outputprelude/maximum_f.html")
    ("maximumBy" . "Outputlist/maximumBy_f.html")
    ("maybe" . "Outputprelude/maybe_f.html")
    ("maybeToList" . "Outputmaybe/maybeToList_f.html")
    ("min" . "Outputprelude/min_f.html")
    ("minBound" . "Outputprelude/minBound_f.html")
    ("minimum" . "Outputprelude/minimum_f.html")
    ("minimumBy" . "Outputlist/minimumBy_f.html")
    ("mkPolar" . "Outputcomplex/mkPolar_f.html")
    ("mkStdGen" . "Outputrandom/mkStdGen_f.html")
    ("mod" . "Outputprelude/mod_f.html")
    ("msum" . "Outputmonad/msum_f.html")
    ("negate" . "Outputprelude/negate_f.html")
    ("newStdGen" . "Outputrandom/newStdGen_f.html")
    ("next" . "Outputrandom/next_f.html")
    ("not" . "Outputprelude/not_f.html")
    ("notElem" . "Outputprelude/notElem_f.html")
    ("nub" . "Outputlist/nub_f.html")
    ("nubBy" . "Outputlist/nubBy_f.html")
    ("null" . "Outputprelude/null_f.html")
    ("numerator" . "Outputratio/numerator_f.html")
    ("odd" . "Outputprelude/odd_f.html")
    ("openFile" . "Outputio/openFile_f.html")
    ("or" . "Outputprelude/or_f.html")
    ("ord" . "Outputchar/ord_f.html")
    ("otherwise" . "Outputprelude/otherwise_f.html")
    ("partition" . "Outputlist/partition_f.html")
    ("phase" . "Outputcomplex/phase_f.html")
    ("pi" . "Outputprelude/pi_f.html")
    ("polar" . "Outputcomplex/polar_f.html")
    ("pred" . "Outputprelude/pred_f.html")
    ("print" . "Outputprelude/print_f.html")
    ("product" . "Outputprelude/product_f.html")
    ("properFraction" . "Outputprelude/properFraction_f.html")
    ("putChar" . "Outputprelude/putChar_f.html")
    ("putStr" . "Outputprelude/putStr_f.html")
    ("putStrLn" . "Outputprelude/putStrLn_f.html")
    ("quot" . "Outputprelude/quot_f.html")
    ("quotRem" . "Outputprelude/quotRem_f.html")
    ("random" . "Outputrandom/random_f.html")
    ("randomIO" . "Outputrandom/randomIO_f.html")
    ("randomR" . "Outputrandom/randomR_f.html")
    ("randomRIO" . "Outputrandom/randomRIO_f.html")
    ("randomRs" . "Outputrandom/randomRs_f.html")
    ("randoms" . "Outputrandom/randoms_f.html")
    ("range" . "Outputix/range_f.html")
    ("rangeSize" . "Outputix/rangeSize_f.html")
    ("read" . "Outputprelude/read_f.html")
    ("readable" . "Outputdirectory/readable_f.html")
    ("readDec" . "Outputnumeric/readDec_f.html")
    ("readFile" . "Outputprelude/readFile_f.html")
    ("readFloat" . "Outputnumeric/readFloat_f.html")
    ("readHex" . "Outputnumeric/readHex_f.html")
    ("readInt" . "Outputnumeric/readInt_f.html")
    ("readIO" . "Outputprelude/readIO_f.html")
    ("readList" . "Outputprelude/readList_f.html")
    ("readLitChar" . "Outputchar/readLitChar_f.html")
    ("readLn" . "Outputprelude/readLn_f.html")
    ("readOct" . "Outputnumeric/readOct_f.html")
    ("readParen" . "Outputprelude/readParen_f.html")
    ("reads" . "Outputprelude/reads_f.html")
    ("readSigned" . "Outputnumeric/readSigned_f.html")
    ("readsPrec" . "Outputprelude/readsPrec_f.html")
    ("realPart" . "Outputcomplex/realPart_f.html")
    ("realToFrac" . "Outputprelude/realToFrac_f.html")
    ("recip" . "Outputprelude/recip_f.html")
    ("rem" . "Outputprelude/rem_f.html")
    ("removeDirectory" . "Outputdirectory/removeDirectory_f.html")
    ("removeFile" . "Outputdirectory/removeFile_f.html")
    ("renameDirectory" . "Outputdirectory/renameDirectory_f.html")
    ("renameFile" . "Outputdirectory/renameFile_f.html")
    ("repeat" . "Outputprelude/repeat_f.html")
    ("replicate" . "Outputprelude/replicate_f.html")
    ("return" . "Outputprelude/return_f.html")
    ("reverse" . "Outputprelude/reverse_f.html")
    ("round" . "Outputprelude/round_f.html")
    ("scaleFloat" . "Outputprelude/scaleFloat_f.html")
    ("scanl" . "Outputprelude/scanl_f.html")
    ("scanl1" . "Outputprelude/scanl1_f.html")
    ("scanr" . "Outputprelude/scanr_f.html")
    ("scanr1" . "Outputprelude/scanr1_f.html")
    ("searchable" . "Outputdirectory/searchable_f.html")
    ("seq" . "Outputprelude/seq_f.html")
    ("sequence" . "Outputprelude/sequence_f.html")
    ("sequence_" . "Outputprelude/sequence__f.html")
    ("setCurrentDirectory" . "Outputdirectory/setCurrentDirectory_f.html")
    ("setPermissions" . "Outputdirectory/setPermissions_f.html")
    ("setStdGen" . "Outputrandom/setStdGen_f.html")
    ("show" . "Outputprelude/show_f.html")
    ("showChar" . "Outputprelude/showChar_f.html")
    ("showEFloat" . "Outputnumeric/showEFloat_f.html")
    ("showFFloat" . "Outputnumeric/showFFloat_f.html")
    ("showFloat" . "Outputnumeric/showFloat_f.html")
    ("showGFloat" . "Outputnumeric/showGFloat_f.html")
    ("showInt" . "Outputnumeric/showInt_f.html")
    ("showList" . "Outputprelude/showList_f.html")
    ("showLitChar" . "Outputchar/showLitChar_f.html")
    ("showParen" . "Outputprelude/showParen_f.html")
    ("shows" . "Outputprelude/shows_f.html")
    ("showSigned" . "Outputnumeric/showSigned_f.html")
    ("showsPrec" . "Outputprelude/showsPrec_f.html")
    ("showString" . "Outputprelude/showString_f.html")
    ("significand" . "Outputprelude/significand_f.html")
    ("signum" . "Outputprelude/signum_f.html")
    ("sin" . "Outputprelude/sin_f.html")
    ("sinh" . "Outputprelude/sinh_f.html")
    ("snd" . "Outputprelude/snd_f.html")
    ("sort" . "Outputlist/sort_f.html")
    ("sortBy" . "Outputlist/sortBy_f.html")
    ("split" . "Outputrandom/split_f.html")
    ("splitAt" . "Outputprelude/splitAt_f.html")
    ("sqrt" . "Outputprelude/sqrt_f.html")
    ("stderr" . "Outputio/stderr_f.html")
    ("stdin" . "Outputio/stdin_f.html")
    ("stdout" . "Outputio/stdout_f.html")
    ("subtract" . "Outputprelude/subtract_f.html")
    ("succ" . "Outputprelude/succ_f.html")
    ("sum" . "Outputprelude/sum_f.html")
    ("system" . "Outputsystem/system_f.html")
    ("tail" . "Outputprelude/tail_f.html")
    ("tails" . "Outputlist/tails_f.html")
    ("take" . "Outputprelude/take_f.html")
    ("takeWhile" . "Outputprelude/takeWhile_f.html")
    ("tan" . "Outputprelude/tan_f.html")
    ("tanh" . "Outputprelude/tanh_f.html")
    ("toCalendarTime" . "Outputtime/toCalendarTime_f.html")
    ("toClockTime" . "Outputtime/toClockTime_f.html")
    ("toEnum" . "Outputprelude/toEnum_f.html")
    ("toInteger" . "Outputprelude/toInteger_f.html")
    ("toLower" . "Outputchar/toLower_f.html")
    ("toRational" . "Outputprelude/toRational_f.html")
    ("toUpper" . "Outputchar/toUpper_f.html")
    ("toUTCTime" . "Outputtime/toUTCTime_f.html")
    ("transpose" . "Outputlist/transpose_f.html")
    ("truncate" . "Outputprelude/truncate_f.html")
    ("try" . "Outputio/try_f.html")
    ("uncurry" . "Outputprelude/uncurry_f.html")
    ("undefined" . "Outputprelude/undefined_f.html")
    ("unfoldr" . "Outputlist/unfoldr_f.html")
    ("union" . "Outputlist/union_f.html")
    ("unionBy" . "Outputlist/unionBy_f.html")
    ("unless" . "Outputmonad/unless_f.html")
    ("unlines" . "Outputprelude/unlines_f.html")
    ("until" . "Outputprelude/until_f.html")
    ("unwords" . "Outputprelude/unwords_f.html")
    ("unzip" . "Outputprelude/unzip_f.html")
    ("unzip3" . "Outputprelude/unzip3_f.html")
    ("unzip4" . "Outputlist/unzip4_f.html")
    ("unzip5" . "Outputlist/unzip5_f.html")
    ("unzip6" . "Outputlist/unzip6_f.html")
    ("unzip7" . "Outputlist/unzip7_f.html")
    ("userError" . "Outputprelude/userError_f.html")
    ("when" . "Outputmonad/when_f.html")
    ("words" . "Outputprelude/words_f.html")
    ("writable" . "Outputdirectory/writable_f.html")
    ("writeFile" . "Outputprelude/writeFile_f.html")
    ("zip" . "Outputprelude/zip_f.html")
    ("zip3" . "Outputprelude/zip3_f.html")
    ("zip4" . "Outputlist/zip4_f.html")
    ("zip5" . "Outputlist/zip5_f.html")
    ("zip6" . "Outputlist/zip6_f.html")
    ("zip7" . "Outputlist/zip7_f.html")
    ("zipWith" . "Outputprelude/zipWith_f.html")
    ("zipWith3" . "Outputprelude/zipWith3_f.html")
    ("zipWith4" . "Outputlist/zipWith4_f.html")
    ("zipWith5" . "Outputlist/zipWith5_f.html")
    ("zipWith6" . "Outputlist/zipWith6_f.html")
    ("zipWith7" . "Outputlist/zipWith7_f.html")
    ("zipWithM" . "Outputmonad/zipWithM_f.html")
    ("zipWithM_" . "Outputmonad/zipWithM__f.html")))

(defvar *haskell-reference-ops*
  '(("!" . "Outputarray/E_o.html")
    ("!!" . "Outputprelude/EE_o.html")
    ("$" . "Outputprelude/D_o.html")
    ("$!" . "Outputprelude/DE_o.html")
    ("%" . "Outputratio/A_o.html")
    ("&&" . "Outputprelude/FF_o.html")
    ("*" . "Outputprelude/G_o.html")
    ("**" . "Outputprelude/GG_o.html")
    ("+" . "Outputprelude/H_o.html")
    ("++" . "Outputprelude/HH_o.html")
    ("-" . "Outputprelude/-_o.html")
    ("." . "Outputprelude/I_o.html")
    ("/" . "Outputprelude/J_o.html")
    ("//" . "Outputarray/JJ_o.html")
    ("/=" . "Outputprelude/JL_o.html")
    (":" . "Outputprelude/C_o.html")
    (":+" . "Outputcomplex/CH_o.html")
    ("<" . "Outputprelude/M_o.html")
    ("<=" . "Outputprelude/ML_o.html")
    ("=<<" . "Outputprelude/LMM_o.html")
    ("==" . "Outputprelude/LL_o.html")
    (">" . "Outputprelude/N_o.html")
    (">=" . "Outputprelude/NL_o.html")
    (">>" . "Outputprelude/NN_o.html")
    (">>=" . "Outputprelude/NNL_o.html")
    ("\\" . "Outputlist/KK_o.html")
    ("^" . "Outputprelude/^_o.html")
    ("^^" . "Outputprelude/^^_o.html")
    ("||" . "Outputprelude/BB_o.html")))

(defvar *haskell-reference-classes*
  '(("Bounded" . "Outputprelude/Bounded_c.html")
    ("Enum" . "Outputprelude/Enum_c.html")
    ("Eq" . "Outputprelude/Eq_c.html")
    ("Floating" . "Outputprelude/Floating_c.html")
    ("Fractional" . "Outputprelude/Fractional_c.html")
    ("Functor" . "Outputprelude/Functor_c.html")
    ("Integral" . "Outputprelude/Integral_c.html")
    ("Ix" . "Outputix/Ix_c.html")
    ("Monad" . "Outputprelude/Monad_c.html")
    ("MonadPlus" . "Outputmonad/MonadPlus_c.html")
    ("Num" . "Outputprelude/Num_c.html")
    ("Ord" . "Outputprelude/Ord_c.html")
    ("Random" . "Outputrandom/Random_c.html")
    ("RandomGen" . "Outputrandom/RandomGen_c.html")
    ("Read" . "Outputprelude/Read_c.html")
    ("Real" . "Outputprelude/Real_c.html")
    ("RealFloat" . "Outputprelude/RealFloat_c.html")
    ("RealFrac" . "Outputprelude/RealFrac_c.html")
    ("Show" . "Outputprelude/Show_c.html")))

(defun haskell-reference-lookup ()
  "Look up a function or operator in the haskell reference"
  (interactive)
  (let* ((table (append *haskell-reference-functions*
                        *haskell-reference-ops*
                        *haskell-reference-classes*))
         (symbol (completing-read "Function/operator/class: " table nil t
                                  (let ((word (or (thing-at-point 'word)
                                                  (thing-at-point 'sexp))))
                                    (if (assoc word table) word nil)))))
    (funcall (if (fboundp 'w3m) 'w3m 'browse-url)
             (format "%s/%s" *haskell-reference-location*
                     (cdr (assoc symbol table))))))

(provide 'haskell-ref)
;;; haskell-ref.el ends here
