add Haskell instructions
authorjim <jim@web>
Sat, 4 Apr 2015 22:15:26 +0000 (18:15 -0400)
committerLinux User <ikiwiki@localhost.members.linode.com>
Sat, 4 Apr 2015 22:15:26 +0000 (18:15 -0400)
juli8.mdwn

index ee662c3..e3fa29d 100644 (file)
@@ -92,7 +92,68 @@ If you're only going to use Juli8 for OCaml and not for Haskell, you can skip ah
 
 ## Setting up Haskell for use with Juli8 ##
 
-Will add...
+1. When (If) you installed Haskell, we hope you did it via a method that gave you the Haskell Platform. This will give you a recent version of the Glasgow Haskell Compiler (GHC), which comes with the interactive Haskell session program `ghci`, along with the **Cabal** package manager (the analogue of OCaml's OPAM) and also with a collection of the most widely-used libraries in the Haskell community, that don't come along with GHC itself.
+
+2. Assuming you do have Cabal, we recommend you do the following. First, find out where Cabal installs logs of its activity. On my Mac, it puts them in the folder `~/Library/Haskell/logs/world`. Now what I did was to type the following command in a Terminal:
+
+        ln -s ~/Library/Haskell/logs/world ~/.cabal
+
+    Now I can find a link to what Cabal has done inside cabal's own folder, without needing to remember or hunt down where the hell on my disk that information has been stored. (Alright, to be honest, you can skip this whole step if you want. But I recommend doing it.)
+
+3. Still assuming you have Cabal, type the following in a Terminal:
+
+        cabal update
+        cabal install --user ghc-paths semigroups hoogle
+
+4. If you haven't already downloaded and installed the Juli8 libraries as described in Step 4 under the previous OCaml section, do that now. Also type the following lines in a Terminal:
+
+        ln -s ~/.juli8/haskell ~/.ghc/juli8
+
+5. Check to see whether any of the following files exist on your system. `$HOME` will be some directory like `/Users/jim` or `/home/jim` or `C:/Documents\ and\ Settings/jim`:
+
+    * $HOME/.ghci
+    * $HOME/.ghc/ghci.conf
+    * $HOME/"Application Data"/ghc/ghci.conf
+
+    If you find such a file, you will add lines to it in the next step. If you don't find such a file, create one.
+
+6. Add these lines to the `.ghci` or `ghci.conf` file identified in the previous step:
+
+        -- reads ghci commands from any file named in $GHCIRC
+        :cmd (System.Environment.getEnvironment >>= maybe (return "") readFile . lookup "GHCIRC")
+
+        -- special :commands from Juli8
+        :cmd do { dot_ghc <- System.Directory.getAppUserDataDirectory "ghc"; let { juli8 = dot_ghc ++ "/juli8"; cmds = juli8 ++ "/commands" }; juli8_exists <- System.Directory.doesDirectoryExist juli8; cmds_exists <- System.Directory.doesFileExist cmds; Control.Monad.when cmds_exists $ putStrLn "Loading juli8/commands ..."; return $ unlines $ if cmds_exists then [":set -i"++juli8, ":script "++cmds] else if juli8_exists then [":set -i"++juli8] else [] }
+
+        :def! url (\l->return $ ":!open "++l)
+        -- :set editor vim
+        -- :set +m -- for multiline input
+        -- :set +t -- to print types after each binding
+
+        :load Juli8
+
+    You may want to uncomment the `:set editor vim` line, but only if you know how to use the text editor `vim`. Other text editors you may be familiar with, and can use here are:
+
+        :set editor emacs
+        :set editor nano
+        :set editor open -a TextEdit -- Mac-only
+        :set editor bbedit -- Mac-only, see http://www.barebones.com/support/bbedit/cmd-line-tools.html
+        :set editor mate -- Mac-only, see http://manual.macromates.com/en/using_textmate_from_terminal.html
+        -- for Windows, use one of https://wiki.haskell.org/Windows#Editors
+
+    You may want to uncomment the `:set +m` line. What this does is let you type multi-line commands in the `ghci` sessions. There is a diffeent way to do that, where you type like this:
+
+        :{
+        multiline
+          command
+        :}
+
+    but that's pretty cumbersome. The downside of having `:set +m` on is that sometimes you'll have to type an extra blank line before `ghci` will respond to your input.
+
+If everything works, then when you start up GHCi, you should see a prompt like this:
+
+    *Juli8>
+
 
 ## Using the Juli8 libraries with OCaml ##