{ "metadata": { "language": "haskell", "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "![](https://raw2.github.com/gibiansky/IHaskell/master/images/ihaskell-logo-small.png)\n", "\n", "IHaskell Notebook\n", "===\n", "Hello, and welcome to the **IHaskell Notebook**. IHaskell Notebook is similar to an interactive shell along the lines of GHCi. However, it is much more powerful, and provides features such as syntax highlighting, autocompletion, multi-line input cells, integrated documentation, rich output visualization, and more. In this notebook, I'd like to demonstrate many of the awesome features IHaskell provides.\n", "\n", "IHaskell is implemented as a language kernel for the [IPython](http://ipython.org) project, which means that although the entire thing is written only in Haskell, we get a beautiful notebook interface practically for free.\n", "\n", "We can start with very simple Haskell expressions:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "-- First of all, we can evaluate simple expressions.\n", "3 + 5\n", "\"Hello, \" ++ \"World!\"" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "display_data", "text": [ "8" ] }, { "metadata": {}, "output_type": "display_data", "text": [ "\"Hello, World!\"" ] } ], "prompt_number": 1 }, { "cell_type": "markdown", "metadata": {}, "source": [ "As you can see, each input cell get an execution number. The first input cell is labeled `In [1]`. Just like in GHCi, the output of the last executed statement or expression is available via the `it` variable - however, in addition, the output of the $n$th cell is available via the `itN` variable. For example, if we wanted to see what the first cell printed, we can go ahead and output that:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "it1" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "display_data", "text": [ "\"Hello, World!\"" ] } ], "prompt_number": 2 }, { "cell_type": "markdown", "metadata": {}, "source": [ "In addition to simple code cells such as the ones you see, you can also have other types of cells. All of this inline text, for instance, is written using Markdown cells, which support the majority of Github markdown syntax. This lets you embed images and formatting and arbitrary HTML interspersed with your Haskell code. In addition, you can export these notebooks into HTML or even as presentations using `reveal.js`. \n", "\n", "Alright, back to code. Let's do something slightly fancier:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "-- Unlike in GHCi, we can have multi-line expressions.\n", "concat [\n", " \"Hello\",\n", " \", \",\n", " \"World!\"\n", " ] :: String" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "display_data", "text": [ "\"Hello, World!\"" ] } ], "prompt_number": 3 }, { "cell_type": "markdown", "metadata": {}, "source": [ "In addition to multi-line expressions, IHaskell supports most things that you could put in a standard Haskell file. For example, we can have function bindings without the `let` that GHCi requires. (As long as you group type signatures and their corresponding declarations together, you can use pattern matching and put signatures on your top-level declarations!)" ] }, { "cell_type": "code", "collapsed": false, "input": [ "thing :: String -> Int -> Int\n", "thing \"no\" _ = 100\n", "thing str int = int + length str\n", "\n", "thing \"no\" 10\n", "thing \"ah\" 10" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "display_data", "text": [ "100" ] }, { "metadata": {}, "output_type": "display_data", "text": [ "12" ] } ], "prompt_number": 4 }, { "cell_type": "markdown", "metadata": {}, "source": [ "So far we've just looked at pure functions, but nothing is stopping us from doing IO." ] }, { "cell_type": "code", "collapsed": false, "input": [ "print \"What's going on?\"" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "display_data", "text": [ "\"What's going on?\"" ] } ], "prompt_number": 5 }, { "cell_type": "markdown", "metadata": {}, "source": [ "IHaskell supports most GHC extensions via the `:extension` directive (or any shorthand thereof)." ] }, { "cell_type": "code", "collapsed": false, "input": [ "-- We can disable extensions.\n", ":ext NoEmptyDataDecls\n", "data Thing" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "`Thing' has no constructors (-XEmptyDataDecls permits this)
In the data declaration for `Thing'
" ], "metadata": {}, "output_type": "display_data", "text": [ "`Thing' has no constructors (-XEmptyDataDecls permits this)\n", "In the data declaration for `Thing'" ] } ], "prompt_number": 6 }, { "cell_type": "code", "collapsed": false, "input": [ "-- And enable extensions.\n", ":ext EmptyDataDecls\n", "data Thing" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 7 }, { "cell_type": "markdown", "metadata": {}, "source": [ "Data declarations do pretty much what you expect, and work fine on multiple lines. If a declaration turns out to be not quite what you wanted, you can just go back, edit it, and re-evaluate the code cell." ] }, { "cell_type": "code", "collapsed": false, "input": [ "-- Various data declarations work fine.\n", "data One\n", " = A String\n", " | B Int\n", " deriving Show\n", "\n", "print [A \"Hello\", B 10]" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "display_data", "text": [ "[A \"Hello\",B 10]" ] } ], "prompt_number": 8 }, { "cell_type": "markdown", "metadata": {}, "source": [ "Although this doesn't hold everywhere, we've tried to keep IHaskell relatively similar to GHCi in terms of naming. So, just like in GHCi, you can inspect types with `:type` (or shorthands):" ] }, { "cell_type": "code", "collapsed": false, "input": [ "-- We can look at types like in GHCi.\n", ":ty 3 + 3" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "forall a. Num a => a" ], "metadata": {}, "output_type": "display_data", "text": [ "forall a. Num a => a" ] } ], "prompt_number": 9 }, { "cell_type": "markdown", "metadata": {}, "source": [ "The same goes for the `:info` command. However, unlike GHCi, which simply prints info, the IHaskell notebook brings up a separate pane." ] }, { "cell_type": "code", "collapsed": false, "input": [ "-- What is the Integral typeclass?\n", ":info Integral" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "display_data" } ], "prompt_number": 10 }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you're looking at this notebook after it's been exported to HTML, you won't be able to see this interactive pane. However, it looks approximately like this:\n", "\n", "![](https://raw2.github.com/gibiansky/IHaskell/master/demo/info-demo.png)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can now write slightly more complicated scripts." ] }, { "cell_type": "code", "collapsed": false, "input": [ "-- Results are printed as we go, even from a single expression.\n", "import Control.Monad\n", "import Control.Concurrent\n", "\n", "forM_ [1..5] $ \\x -> do\n", " print x\n", " threadDelay $ 200 * 1000" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "display_data", "text": [ "1\n", "2\n", "3\n", "4\n", "5" ] } ], "prompt_number": 11 }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is where the similarities with GHCi end, and the particularly shiny features of IHaskell begin.\n", "\n", "Although looking at text outputs is often enough, there are many times where we really want a richer output. Suppose we have a custom data type for color:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "data Color = Red | Green | Blue" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 12 }, { "cell_type": "markdown", "metadata": {}, "source": [ "If we were playing around with designing GUI applications, for instance, we might want to actually *see* these colors, instead of just seeing the text \"Red\", \"Green\", and \"Blue\" when we are debugging.\n", "\n", "IHaskell lets you define a custom display mechanism for any data type via its `IHaskellDisplay` typeclass. Since you can use IHaskell in console mode as well as notebook mode, you can provide a list of display outputs for any data type, and the frontend will simply choose the best one. Here's how you would implement a very simple display mechanism for this `Color` data type:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import IHaskell.Display\n", "\n", "instance IHaskellDisplay Color where\n", " display color = return $ Display [html code]\n", " where\n", " code = concat [\"
Look!
\"]\n", " css Red = \"red\"\n", " css Blue = \"blue\"\n", " css Green = \"green\"" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 13 }, { "cell_type": "markdown", "metadata": {}, "source": [ "Once we define a custom `display :: a -> IO Display` function, we can simply output a `Color`:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "Red\n", "Green\n", "Blue" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "
Look!
" ], "metadata": {}, "output_type": "display_data" }, { "html": [ "
Look!
" ], "metadata": {}, "output_type": "display_data" }, { "html": [ "
Look!
" ], "metadata": {}, "output_type": "display_data" } ], "prompt_number": 14 }, { "cell_type": "markdown", "metadata": {}, "source": [ "The `DisplayData` type has several constructors which let you display your data as plain text, HTML, images (SVG, PNG, JPG), or even as LaTeX code.\n", "\n", "In order to ship an extension for IHaskell, simply create a package named `ihaskell-thing` with a module named `IHaskell.Display.Thing`. As long as `ihaskell-thing` is installed, IHaskell will detect and use it automatically.\n", "\n", "A number of packages already exist, which we can briefly look at. First, in `ihaskell-basic`, we have very simple displays for data types from `Prelude`." ] }, { "cell_type": "code", "collapsed": false, "input": [ "-- We can display Maybes fancily for Show-able types.\n", "Just ()\n", "Nothing\n", "\n", "-- But it dies if it's not showable.\n", "data NoShow = X Int\n", "Just (X 3)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "display_data", "text": [ "Just ()" ] }, { "metadata": {}, "output_type": "display_data", "text": [ "Nothing" ] }, { "html": [ "
Unshowable:NoShowNo instance for (Show NoShow) arising from a use of `print'
Possible fix: add an instance declaration for (Show NoShow)
In a stmt of an interactive GHCi command: print it
" ], "metadata": {}, "output_type": "display_data", "text": [ "No instance for (Show NoShow) arising from a use of `print'\n", "Possible fix: add an instance declaration for (Show NoShow)\n", "In a stmt of an interactive GHCi command: print it" ] } ], "prompt_number": 15 }, { "cell_type": "markdown", "metadata": {}, "source": [ "The `ihaskell-aeson` package adds a display for [Aeson](http://hackage.haskell.org/package/aeson) JSON `Value` types. These are automatically syntax highlighted and formatted nicely." ] }, { "cell_type": "code", "collapsed": false, "input": [ "-- Aeson JSON data types are displayed nicely.\n", ":ext OverloadedStrings\n", "\n", "import Data.Aeson\n", "\n", "data Coord = Coord { x :: Double, y :: Double }\n", "instance ToJSON Coord where\n", " toJSON (Coord x y) = object [\"x\" .= x, \"y\" .= y]\n", "\n", "Null\n", "Bool True\n", "toJSON (Coord 3 2)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "display_data", "text": [ "Null" ] }, { "metadata": {}, "output_type": "display_data", "text": [ "Bool True" ] }, { "metadata": {}, "output_type": "display_data", "text": [ "Object fromList [(\"x\",Number 3.0),(\"y\",Number 2.0)]" ] } ], "prompt_number": 16 }, { "cell_type": "markdown", "metadata": {}, "source": [ "This syntax highlighting may not show up in the exported HTML, as it is done on the fly with Javascript. The result looks like this in the notebook:\n", "\n", "![](https://raw2.github.com/gibiansky/IHaskell/master/demo/json-demo.png)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The `ihaskell-blaze` package lets you play around with HTML straight from within IHaskell using the [Blaze](http://jaspervdj.be/blaze/tutorial.html) library." ] }, { "cell_type": "code", "collapsed": false, "input": [ "-- Small bits of HTML generated via Blaze are displayed.\n", "\n", "import Prelude hiding (div, id)\n", "import Text.Blaze.Html4.Strict hiding (map, style)\n", "import Text.Blaze.Html4.Strict.Attributes\n", "\n", "div ! style \"color: red\" $ do\n", " p \"This is an example of BlazeMarkup syntax.\"\n", " b \"Hello\"\n", " \n", "forM [1..5] $ \\size -> do\n", " let s = toValue $ size * 70\n", " img ! src \"https://www.google.com/images/srpr/logo11w.png\" ! width s" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "
Unshowable:HtmlNo instance for (Show Html) arising from a use of `print'
Possible fix: add an instance declaration for (Show Html)
In a stmt of an interactive GHCi command: print it
" ], "metadata": {}, "output_type": "display_data", "text": [ "No instance for (Show Html) arising from a use of `print'\n", "Possible fix: add an instance declaration for (Show Html)\n", "In a stmt of an interactive GHCi command: print it" ] } ], "prompt_number": 17 }, { "cell_type": "markdown", "metadata": {}, "source": [ "The `ihaskell-diagrams` package allows you to experiment with the [diagrams](http://projects.haskell.org/diagrams/) package. It requires the Cairo backend." ] }, { "cell_type": "code", "collapsed": false, "input": [ "-- We can draw diagrams, right in the notebook.\n", ":extension NoMonomorphismRestriction\n", "import Diagrams.Prelude\n", "\n", "-- By Brent Yorgey\n", "-- Draw a Sierpinski triangle!\n", "sierpinski 1 = eqTriangle 1\n", "sierpinski n = s\n", " ===\n", " (s ||| s) # centerX\n", " where s = sierpinski (n-1)\n", "\n", "-- The `diagram` function is used to display them in the notebook.\n", "diagram $ sierpinski 4\n", " # centerXY\n", " # fc black\n", " `atop` square 10\n", " # fc white" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "Not in scope: `diagram'
Perhaps you meant `dimgray' (imported from Diagrams.Prelude)
" ], "metadata": {}, "output_type": "display_data", "text": [ "Not in scope: `diagram'\n", "Perhaps you meant `dimgray' (imported from Diagrams.Prelude)" ] } ], "prompt_number": 18 }, { "cell_type": "markdown", "metadata": {}, "source": [ "Just like with Diagrams, `ihaskell-chart` allows you to use the [Chart](https://github.com/timbod7/haskell-chart/wiki) library for plotting from within IHaskell." ] }, { "cell_type": "code", "collapsed": false, "input": [ "-- We can draw small charts in the notebook.\n", "-- This example is taken from the haskell-chart documentation.\n", "import Graphics.Rendering.Chart \n", "import Data.Default.Class\n", "import Control.Lens\n", "\n", "let values = [\n", " (\"Mexico City\" , 19.2, 0),\n", " (\"Mumbai\" , 12.9, 10), \n", " (\"Sydney\" , 4.3, 0),\n", " (\"London\" , 8.3, 0), \n", " (\"New York\" , 8.2, 25)]\n", " \n", "pitem (s, v, o) = pitem_value .~ v\n", " $ pitem_label .~ s\n", " $ pitem_offset .~ o\n", " $ def \n", "\n", "-- Convert to a renderable in order to display it.\n", "toRenderable \n", " $ pie_title .~ \"Relative Population\"\n", " $ pie_plot . pie_data .~ map pitem values\n", " $ def" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "
Unshowable:Graphics.Rendering.Chart.Renderable ()No instance for (Show (Graphics.Rendering.Chart.Renderable ())) arising from a use of `print'
Possible fix: add an instance declaration for (Show (Graphics.Rendering.Chart.Renderable ()))
In a stmt of an interactive GHCi command: print it
" ], "metadata": {}, "output_type": "display_data", "text": [ "No instance for (Show (Graphics.Rendering.Chart.Renderable ())) arising from a use of `print'\n", "Possible fix: add an instance declaration for (Show (Graphics.Rendering.Chart.Renderable ()))\n", "In a stmt of an interactive GHCi command: print it" ] } ], "prompt_number": 19 }, { "cell_type": "markdown", "metadata": {}, "source": [ "By default, both `ihaskell-diagrams` and `ihaskell-chart` use SVG displays. However, the notebook does not support interactive resizing for SVG image. However, if you use `:set no-svg`, all SVG outputs will instead be shown as PNG images, and they can be resized easily." ] }, { "cell_type": "code", "collapsed": false, "input": [ ":opt no-svg\n", "\n", "toRenderable \n", " $ pie_title .~ \"Relative Population\"\n", " $ pie_plot . pie_data .~ map pitem values\n", " $ def" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "
Unshowable:Graphics.Rendering.Chart.Renderable ()No instance for (Show (Graphics.Rendering.Chart.Renderable ())) arising from a use of `print'
Possible fix: add an instance declaration for (Show (Graphics.Rendering.Chart.Renderable ()))
In a stmt of an interactive GHCi command: print it
" ], "metadata": {}, "output_type": "display_data", "text": [ "No instance for (Show (Graphics.Rendering.Chart.Renderable ())) arising from a use of `print'\n", "Possible fix: add an instance declaration for (Show (Graphics.Rendering.Chart.Renderable ()))\n", "In a stmt of an interactive GHCi command: print it" ] } ], "prompt_number": 20 }, { "cell_type": "markdown", "metadata": {}, "source": [ "Finally, the `ihaskell-magic` chart uses the [magic](http://hackage.haskell.org/package/magic) library (bindings to `libmagic`) to create a display mechanism for `ByteString`s. If you try to load an image, for instance, you will see that image immediately in the notebook." ] }, { "cell_type": "code", "collapsed": false, "input": [ "import qualified Data.ByteString as B\n", "B.readFile \"code/IHaskell/images/ihaskell-notebook.png\"" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "display_data", "text": [ "\"\\137PNG\\r\\n\\SUB\\n\\NUL\\NUL\\NUL\\rIHDR\\NUL\\NUL\\SOH\\248\\NUL\\NUL\\STXQ\\b\\ACK\\NUL\\NUL\\NUL\\169\\211\\165\\196\\NUL\\NUL\\NUL\\ACKbKGD\\NUL\\255\\NUL\\255\\NUL\\255\\160\\189\\167\\147\\NUL\\NUL\\NUL\\tpHYs\\NUL\\NUL\\v\\DC3\\NUL\\NUL\\v\\DC3\\SOH\\NUL\\154\\156\\CAN\\NUL\\NUL\\NUL\\atIME\\a\\221\\f\\SO\\SYN#\\EOT\\230\\&4S\\217\\NUL\\NUL \\NULIDATx\\218\\236\\221wT\\DC4W\\US\\198\\241\\239\\210\\151\\222\\EOTD\\DC1DQ, \\bvE4\\138\\177\\155\\132h4\\197\\RS\\187\\209\\216M\\244\\141\\198\\CAN\\NAK{\\236\\SUBk\\140\\198\\196Xc\\197\\DC2cW\\EOT;6P\\177\\ETB`iK\\219\\221\\247\\SI\\138X\\146\\128\\162\\162\\249}\\206\\217st\\153\\189;sgf\\159\\185w\\202U\\232t:\\254E5\\160\\&5P\\a(\\SI\\DC4G\\b!\\132\\DLE\\175\\218m\\224\\STXp\\NUL\\216\\NUL\\FS\\251\\167\\137\\NAK\\255\\DLE\\240M\\129\\161@\\160\\212\\169\\DLEB\\bQ\\228\\236\\ENQ&\\SOH[\\v\\DC2\\240\\243\\128\\RSRwB\\b!D\\145\\&7\\US\\232\\249o\\SOHo\\153\\221\\236\\151V\\187\\DLEB\\b\\241f\\181\\230[\\ETX\\t\\DEL\\ETB\\240{$\\220_\\190\\168\\168(\\146\\146\\146\\208j\\181R\\EMB\\b!\\158\\155\\158\\158\\RS\\230\\230\\230\\184\\187\\187\\231\\132|\\131g\\ENQ\\188t\\203\\191\\STXg\\206\\156\\193\\214\\214\\SYNKKK\\f\\f\\f\\164B\\132\\DLEB<\\183\\204\\204LT*\\NAKqqqT\\174\\\\\\EM\\242t\\215\\231\\EOT|S`\\139T\\213\\203o\\185\\ESC\\ESC\\ESCcgg'\\149!\\132\\DLE\\162\\208<|\\248\\144\\180\\180\\180\\156\\150|3`\\171^\\246\\223\\134J\\245\\188|IIIXYYIE\\b!\\132(TVVV$%%\\145\\&7\\211\\245\\200\\186\\207=P\\170\\231\\229\\211j\\181\\210-/\\132\\DLE\\162\\208\\EM\\CAN\\CAN\\228\\189\\174+\\DLE\\168\\166G\\214UwB\\b!\\132x{\\180\\214#\\235\\tuB\\b!\\132x{\\212\\209#\\235\\241\\179B\\b!\\132x{\\148\\215C\\158-/\\132\\DLEB\\188m\\138\\235I\\GS\\b!\\132\\DLEo\\159\\183+\\224u\\EML\\247\\RS\\131B1\\ACK\\133b\\SUB_\\134e>W1\\251:N\\204.c\\f\\181V$\\191\\190\\229\\137[G#3;\\218\\237J|\\187\\183\\194\\148\\195\\244qQ\\162Tf\\189|\\167\\\\\\\"C\\246M!\\132(\\186\\SOH\\191\\167\\253\\132\\220\\160|\\244z\\254\\224\\205\\US\\ENQ.\\131>G\\167\\ESC\\200T\\191\\199oIK\\187\\CANN\\159\\150?\\226a\\155\\&5/\\229\\191}\\240\\204\\DC2\\STX\\150\\rC\\151\\212\\153\\142\\182\\138\\&7w\\205\\170\\&6\\209\\196\\252e\\RS\\FSdp1\\196\\ETB\\165UK\\214?\\204\\251\\184c\\r7\\151\\EOT\\160\\&4\\173\\207\\210\\155\\154\\252\\NAKeZ\\147\\217\\&1j\\212\\241G\\EM\\234\\166\\255\\214\\236\\\\\\233\\ETBgR\\207\\194\\146\\128Y\\151\\US\\GS\\176\\232\\226\\217\\221\\219\\r\\165k\\SIv\\198\\230\\247Q\\197I\\252\\249\\153c\\238\\SOH\\208\\163WY\\134\\134\\171\\139\\224\\182!\\132x\\235\\ETX\\190\\218\\132.\\132\\GS\\239\\206\\230\\225v\\128\\DC3\\147\\247~\\206\\241\\DC3\\159\\&0\\184\\226\\235\\185\\ETB\\\\\\171NCW\\202\\157>\\223\\aR\\207DV\\254\\139\\&1\\196\\181\\217{\\184\\167\\USemD\\158\\160\\208\\197st\\237I\\168\\210\\158\\ACK\\142\\250\\255\\233\\SUB2*\\215\\131\\249\\163+r\\226\\DEL\\ETXX}#\\DC3\\208\\145tt<\\189\\151\\192g\\139\\190\\231\\GS\\219\\252\\238~\\166\\248\\141\\219\\197\\161\\131\\251\\249}\\176\\aP\\133\\t;\\SOr\\240\\240&\\ACKz\\202\\134,\\132x\\r\\SOHo\\238\\234@U?g\\188]\\141\\NUL\\DC3\\202\\250\\DC4\\199\\207\\183\\CAN\\206\\202G\\211li6\\SO\\163z\\DEL\\241\\253\\199\\v(a9\\SYN\\133\\241tZ\\132\\220z)\\243\\163\\172R\\147\\&9\\179\\ESC0\\224cW\\\\\\140\\v\\225\\128!CC\\204\\141\\164B\\155?]B\\EOTs;V\\163\\184R\\137\\210\\190\\n\\237g\\159\\\"\\233\\177\\177\\128\\&4\\220\\221\\&1\\150\\246\\245\\202\\227d\\161D\\169\\&4\\195\\185j0c\\183\\221\\202m!jb\\SYNRG\\169D\\233\\212\\150}\\154\\DC46\\182p\\200m\\237\\r>\\174\\206w9\\249a\\\\\\166\\&5\\173\\\\\\DC2\\248kc$)9o&F\\240\\219\\209t*\\181k\\132\\179A\\225}\\ETB$\\176\\173\\141\\NAKVm\\182=\\SUB*)1\\148\\182\\182f4^\\US\\159g\\165\\196slNw\\STX\\220\\173Q*\\149\\152\\187\\214\\161\\251\\130\\b\\DC2^\\203\\184>\\198T\\236\\187\\128\\DC1n{\\EM:t\\v\\247\\146N3\\181\\231\\\\R?]\\192\\247\\239\\216\\SYN`\\231\\211\\195\\188Te||}\\240*e\\ACKX\\225\\238\\237\\139o\\149\\n\\DC4W*\\RS\\171\\US\\203w&\\DC1\\210\\169\\SYN\\238\\SOf(\\173\\202\\243\\254\\180\\DC3$\\232\\n\\178m\\b!$\\224\\v/\\214\\200\\216\\DEL\\130k\\237>\\226f\\194h\\162\\SYN8\\176o\\248&\\166_)\\250#\\173\\253\\249Y\\b\\165\\\\\\SYN1,\\162\\DLEN9\\232T\\236\\GS\\210\\146/w\\184\\242\\245\\206\\211D\\238\\253\\SYN\\215\\205S9\\249D\\192\\167hR\\n\\195\\194\\252\\174|I\\227\\194\\204V\\EOT}\\DC3E\\192\\164\\157\\156\\190t\\158}!581\\164\\&9}\\182>$\\DEL[\\148\\150\\219\\203\\234>\\163;<\\231\\213\\132M\\170\\130\\FSUz3`\\225@\\138m\\232E\\199\\174\\159\\&15\\174=\\243'4\\194V\\239%\\237K\\a\\151p=\\248\\&7\\\"\\239\\198r~v%\\246\\DEL\\221\\155\\229\\209\\ENQ\\217\\&6\\132\\DLEo\\139\\162\\241\\220T\\159Z\\fof\\t@\\233VU\\169\\161\\191\\150\\208\\139\\EM\\f(c\\252\\223Y\\DC3\\t\\a\\153\\253\\235\\ETX\\188\\199\\134\\208\\163ni\\f(\\203\\215S:\\176\\178\\209\\154<\\DC3\\EMQ\\186\\195w\\140\\203\\243N\\137~#\\t\\154\\214\\134\\205g\\146\\232[\\198&\\159_VX\\229(\\169\\DLE\\252.\\246\\243\\254`\\239\\173\\175\\168\\\\Z\\195\\229?By\\224\\SUBLsw\\163B\\254\\174|H:\\202\\228\\144\\b\\188'\\158gLp\\t\\244\\SOH\\218\\142!d\\243*>\\152w\\NULU\\179V\\216\\252\\235e\\NAKz\\216\\183Z\\194\\DC1\\239$\\158y\\ENQ\\129\\190%\\238\\230\\ENQ\\155-3\\223\\193\\204\\252d)M\\151\\223\\160\\249\\170\\157\\&4\\182}\\137\\199\\213U\\250\\&3\\248\\221\\DC2\\CAN)\\192\\173Eg\\170\\233\\DEL\\198\\238Kj\\250\\186\\ESC\\202\\175\\157\\DLE\\DC2\\240\\175\\154\\STXCG\\ESC\\220r\\230\\196\\192\\DLEs\\ETX\\r\\177j]\\145\\175\\188\\ACK\\171\\134\\163[U8ee\\220\\143$ZmM\\149*\\197rW\\138i\\153\\218\\184\\177\\230\\177\\SYN\\154\\250\\242Z\\198\\f\\250\\142\\NAK\\187#\\137\\205\\211q\\224\\175JC\\155\\239.\\153\\194*\\a\\204\\188\\218\\241\\142\\213J~?\\248\\128\\222%\\147\\217\\179\\229:\\197[\\190\\135\\135q\\225\\DEL\\215\\191\\201\\188\\ETBNxl\\ACKg{\\151\\197\\188\\247\\147\\193w\\DC3\\149\\ACKl\\242\\177\\197\\ESCZ\\187S\\209K\\247\\183\\219\\171~\\SOH/-\\208\\198\\USc\\245\\246\\a\\160\\SI\\135~;\\204\\195V-)\\166\\247\\146\\246%\\a7\\172s\\150Q_\\137\\153A:q\\169Z\\249\\165\\DC3\\226?\\168H\\220&\\167\\208{f\\ACK\\253\\183(\\DC4\\128\\RS\\ACKz\\143\\154\\152\\n}C\\244\\243\\182\\&8SO3\\190\\213\\167,\\214|\\194\\202SwP\\165\\168Q\\223\\223N;+\\ENQ\\217\\195\\254\\230Oa\\149\\ETX`\\225K\\251@%\\167~;F\\236\\189\\253\\252~\\209\\142w\\223/\\143\\242e|\\ETBO4\\191u:\\158.\\194\\134OB\\USdw=\\231y\\GS\\238\\245\\232 \\242\\159\\227\\152\\219\\203\\235caa\\241\\&7\\175fl.H\\ETB\\189\\&6\\158\\189_wg\\153A\\SI6\\134~C\\201\\141}\\249*4\\SYN\\237K\\219\\151\\DC4(\\254\\235\\251\\146\\DLE\\162\\168\\180\\224\\223\\\\\\EM\\137)\\220x\\144IIWK\\f_\\240P\\201\\208\\190\\\"e\\205T\\\\\\186\\154\\132\\182\\142\\EMz@\\218\\205\\147\\220\\210\\129cNV\\196\\133\\179\\247\\154\\&5-\\230\\247$\\176\\180YV\\171\\245\\193\\EM\\\"U\\186g\\172H=\\f\\DC4\\SUB22\\159\\254u/X9\\255\\198\\146j\\GS\\234\\160\\232\\185\\150}{b9c\\209\\136\\177\\149\\205\\158\\239\\187\\DC4\\134\\152\\CAN\\234HKL}F\\NUL\\234aba\\140\\246n\\n9\\157\\NUL\\154\\196\\CANn\\167js\\SI&\\f\\FS|\\241\\177\\137\\227`h\\DC4\\169u\\188x\\190\\235\\203\\v\\179\\139^\\135j\\223(\\186/\\214\\209i\\243\\&7\\188S\\211\\NUL\\171\\158K\\b\\236=\\134O\\194\\166\\DC3`\\245\\186n\\195\\252\\251mC\\b!-\\248|I\\186v\\143\\DC3a\\183\\&8u-\\GSH\\229r\\196m\\194\\194\\239s\\235\\&5^\\176{!\\226\\&6a\\DC1\\SIy\\144\\SO)7\\239q8\\236\\&6's\\174\\DLE+\\160\\253\\159\\207\\196\\221}1_\\159*\\132\\139\\236,k\\208\\187\\173=\\199'\\255\\192\\161\\&8\\r\\186\\212(\\214\\142_JL\\222\\149e\\233\\129\\151\\157\\138c\\219\\\"\\136\\215\\130.\\233\\FS+\\134\\142\\231\\228\\179\\202\\&3v\\166\\146c\\SUB\\199\\215\\132rY\\149Bjj\\SUB9\\191\\231\\ENQ*'\\US\\173j\\235\\154\\GS\\168\\158\\182\\141q\\227\\255\\194\\168~{|,\\158s\\158\\141\\156\\169Q\\213\\146\\232\\213\\139\\216v6\\134\\219w\\US\\144\\144{\\GS\\158\\146\\&2\\129\\158pb)\\ESC\\175\\164\\161\\203\\184\\203\\238\\233\\211\\t\\203\\251y\\243\\234\\f\\SUBT\\149\\235\\DC3\\219\\209kv(\\167\\163\\163\\&9wd+K\\199t\\163\\199\\146\\168|_\\181oh\\227\\129\\183\\175/\\190\\207zy\\151\\193*\\159]\\244:\\213_\\140\\238\\182\\136\\180\\246s\\EM\\215\\192\\SUB=\\204\\241\\US>\\131\\143R\\ETB\\208c\\252\\177'\\238\\144\\248\\231^\\133\\164\\235g\\136\\b\\143\\224\\244\\245d@E\\212\\169p\\194O\\158\\231\\246\\243\\156\\202\\250\\135mC\\b!\\SOH\\159/\\199\\134/\\198\\207\\DEL!-&<\\EOT\\238\\&08p\\SOH\\254U\\DELb\\242\\185\\204\\215\\178\\176\\EM\\151\\SI\\242\\129\\239\\STX\\252\\235mf\\135\\SUBn\\204\\255\\149Z\\254\\v\\168\\214\\247\\250\\235_\\DC3\\n+\\STX&n$\\164\\202v>,]\\140\\226\\RS\\173Y]\\178-\\158y\\167\\&1\\171\\201\\184\\159G\\227\\177\\190\\r\\165\\236\\139\\227\\234\\219\\149=\\254Cii\\253\\140\\213h\\226\\197\\192i}(\\179\\187#^Nv\\216\\216x24L]\\240r\\242\\179\\DC1\\217\\213\\165\\131O\\\"\\231\\163\\NAK\\212\\238\\224\\143\\229\\243\\206\\&3\\150\\EOTLXH_\\199\\181|\\228_\\SOw\\183\\170\\140<\\145s\\ETX\\158>%\\219\\205d|\\131K\\f\\168l\\131C\\185\\214\\172(\\246\\EM\\129&y\\203\\&1\\166\\194\\192\\205\\236\\154\\DC2\\192\\213\\EM\\237\\168^\\177\\\"~A\\221\\152r@AEO\\ESC^\\233]\\249:\\NAK\\a\\198teA\\242\\a\\204\\153\\216\\EOT\\187\\236\\217\\212\\179m\\196\\184\\144 \\238\\207\\252\\156)\\167R\\242YX\\na_\\191C\\173\\218uy\\DEL\\242%\\224$\\195\\131jS\\187fK\\166E\\166\\SYN|\\222\\254i\\219\\DLEB\\188\\&5\\DC4\\186\\130\\159\\b-\\186t\\EML\\175\\242=S\\131\\186s}\\242\\v\\142\\161\\147|\\157N\\165\\150ra\\250 \\SO}jV(\\179\\ETB\\DC1\\DC1\\129\\167\\167\\167luB\\b!\\n]dd$>>>\\175\\166\\ENQ\\255\\154R\\158\\152)\\v^\\252Y\\244\\230KX\\SYN+\\253\\150B\\b!\\164\\ENQ/\\164\\ENQ/\\132\\DLEBZ\\240B\\b!\\132xY$\\224\\133\\DLEB\\b\\tx!\\132\\DLEBH\\192\\v\\241\\134SM3fS%c\\162n\\252\\247\\150]}\\252KJ\\155\\215dA\\140F6\\EOT!$\\224\\133\\DLEY\\210\\185\\&0\\173\\SYN\\230V\\141Xt-\\239\\221\\FSi\\156\\155\\224\\143\\169M\\DC3\\SYN_\\203\\255]\\RSZU\\EOT?\\246mDy\\251\\172Q\\237l\\\\\\170\\DLE\\212\\237\\aN$>q\\141\\172j\\DC3M\\204\\237h\\183+\\241\\133\\151@\\223\\174\\SUB\\193\\US7\\167\\156\\153BV\\167\\DLE\\DC2\\240B\\136,F\\148\\239\\&1\\135\\129\\165\\SO0j\\228V\\RSd?{73f5\\131&FRe\\244L>v\\205\\231\\131\\129\\&5\\183\\249\\181Sc\\250n\\178\\166\\203\\162\\221\\FS9\\250\\ETB\\235f\\245\\165\\154\\&6\\138\\155/qP&\\163\\210\\237\\t\\153?\\138@[\\249\\153\\DLEB\\STX^\\b\\241\\136\\169\\SI\\131gwG\\249\\251 &\\FSMB\\167\\141e\\231\\168\\145\\252Y\\242K\\230\\244(O\\190\\aCN:\\206\\242\\157I\\212\\n\\153\\203\\208\\&6\\181\\240\\246\\242'\\176uw\\190[<\\141\\150\\SOY\\187\\176&f!u\\148J\\148Nm\\217\\167Iac\\v\\135\\236\\241\\235\\203\\&2\\248\\184\\250\\177\\158\\133\\200\\239\\189\\&1\\175\\&4\\146u?\\246!\\192\\205\\&2\\171G\\160b\\ETB\\254x\\152u\\DC4\\146r\\228\\vJ+\\149\\217\\159\\DELV\\ETB}\\STX\\219\\218Xa\\249\\206$B:\\213\\194\\221\\193\\f\\165Uy\\222\\159v\\130\\132<\\199\\ESC\\186\\164\\211,\\236\\\\\\157\\226J%\\202b\\190|:\\233;j\\155\\SYNN\\239\\130\\DLEB\\STX^\\136\\215H\\129U\\221\\209\\204\\248 \\137\\249\\ETX\\230\\DC3~(\\132/\\215\\152\\208}\\206 |L\\vP\\140\\190\\&5N\\SYNp%\\244\\&0\\183\\210\\255f\\DC2\\151\\238\\FSP\\171Q\\223YC\\128\\190)\\173\\&6\\223\\203\\RSI\\239\\&2\\147\\253\\149Ow\\nD-a\\216\\250\\146\\140\\222s\\147\\132\\216\\235\\252\\&9\\165\\&5.\\134Y]\\241\\166\\&5f\\DLE\\173V\\DC3\\251W/\\156\\254\\246\\249\\190:2\\SO.\\225z\\240oD\\222\\141\\229\\252\\236J\\236\\255\\186\\&7\\203\\163\\179\\159\\248\\175K`\\255\\240V\\244\\223\\234\\204\\240m\\167\\184\\176o<\\238\\155\\167\\DC2.O\\221\\DLEB\\STX^\\136\\183c\\SI\\179\\167\\233\\132\\137\\EOT^\\EMEP\\243\\233$\\EOT\\207dT\\GS+\\ntV\\219\\188&c\\230t\\165\\216/m)\\235P\\150Z-;3l\\198zN\\197\\189\\200\\152\\SOe\\EM2{\\b\\141J[`\\168,\\134w\\211\\214x[\\SYN\\240\\\\{\\149\\254\\f~\\183\\EOTF\\nc\\220Zt\\166\\154\\254\\ENQv_\\202\\238-H8\\204\\172\\213w\\240\\254z\\SUB}\\234{P\\170BS\\134\\133|\\146;2\\162\\DLEB\\STX^\\136\\&7\\158A\\201\\182|\\223\\175\\&4\\201iU\\CAN=\\238]\\236\\v\\188\\215\\EMR\\242\\189Y\\FS\\187}\\145?W\\140\\224\\189\\nZ\\194~\\232@\\141r-\\153u\\225\\249FBT\\148\\172C5\\135\\ETB\\EM-Z\\129\\161\\131\\ESC\\214\\&9E\\232+13H'15\\171\\155?\\227\\193\\&9.'[S\\185\\138C\\238\\176\\192&n\\213q\\149\\235\\245\\132\\144\\128\\ETB\\226-\\138x\\172\\139[\\STXV8[=\\255\\152v\\nS\\ETB\\170\\183\\236\\202\\208I\\203\\b\\141\\216K?\\155\\189\\140\\159|\\140\\228\\231\\217\\241\\141\\205\\&1z\\193\\176U\\232)\\158\\238\\137\\144.x!$\\224\\133\\DLE/@\\233D\\EM[H\\190\\159\\132\\230\\137]\\218@\\161!\\227\\&5\\SI\\240nX\\172\\DC2\\RSf\\241\\156>y\\151\\156\\DC3\\t\\169W\\143rM\\SO\\NUL\\132\\144\\128\\ETBBdK9\\198\\136&-\\232;u\\NAK[\\SI\\158\\228\\236\\201\\191\\248\\229\\219\\RS\\252\\239\\164\\tu\\131\\189xl0ccg*9\\166q|M(\\151U)\\164\\166\\166\\241Z\\178\\222\\162\\ACK}>r\\226\\244\\183\\ETX\\248a\\239%b\\\"\\183\\&1i\\248/\\220\\149\\181)\\132\\EOT\\188\\DLE\\\"\\155\\145\\v\\r\\SUB:rq\\217P>~\\167&\\254\\&5\\131\\232\\179*\\149\\SYN![X\\209\\190\\EOT\\143u\\250\\155x1pZ\\US\\202\\236\\238\\136\\151\\147\\GS66\\158\\f\\rS\\231\\255\\187\\&2\\175\\&3\\175f\\214-r\\182\\245\\230rGs\\146/\\202\\153g\\221J\\247\\225N\\DC2\\242[\\142\\194\\146\\186\\DC360\\189\\233-&4\\245\\166\\\\\\192\\215\\\\o5\\128\\170z\\250\\CAN\\234\\201\\137x!^\\ENQ\\EM.\\246\\NAK\\146\\225b\\223<\\170i\\198\\236[\\EOT\\149\\182\\167\\225^R\\234\\227Ed\\\\\\158FM\\159\\ENQ\\180\\&8\\DC4\\193\\CAN/c\\169\\DLE!\\n\\217\\147\\195\\197\\SUBH\\149\\b!^\\134\\180Kk\\248\\241\\152#\\r\\223\\241\\161\\184\\246\\n\\235\\198\\206\\228\\162G\\ETB\\130=$\\220\\133x\\NAK\\164\\139^\\b\\241R\\232\\210o\\177kb{\\170\\187\\&9\\225\\228\\222\\152\\t\\247\\131Y\\246\\251\\DLE\\188L\\164n\\132x\\NAK\\164\\ENQ/\\196?0m\\157A5\\US\\176\\180\\147\\186((\\147J\\ETXX{r\\128T\\132\\DLE\\DC2\\240B\\DC4=\\134\\238Z\\156\\220\\165\\RS\\132\\DLEo\\RS\\233\\162\\ETBB\\b!$\\224\\133\\DLEB\\b!\\SOH/\\196\\ESCN5\\205\\152M\\149\\140\\137\\186Q\\196g4\\229\\&0}\\\\r\\134xU\\226;\\229\\DC2\\EM\\178\\250\\132\\144\\128\\ETBB\\188\\EOTy\\RS\\SUB\\243\\244\\171\\t\\155T\\249-H\\203\\189\\159\\235?\\187\\156j\\179\\136\\206\\EOTLk2;F\\141:\\254(C\\221\\244_\\205\\242\\169\\&6\\209\\196\\\\\\198w\\ETB\\162\\168\\146\\139\\236\\132xi{\\151\\DC3\\US.?B\\141\\228\\236\\240i\\135\\183iA\\v\\172\\192W\\ESC\\ETB\\209\\220\\254\\209\\147\\224\\244\\205\\\\(!{\\177\\DLEBZ\\240B\\188JF\\216\\149\\243\\198\\215\\215\\&7\\235\\229\\227A\\198\\150il\\208\\&4c\\246\\194\\207p5,hy\\230\\184y\\251<*\\207\\215\\ETB\\239r\\246\\CAN\\NAK\\164\\136\\244\\235l\\FS\\217\\130\\138\\246Y=\\NUL\\197}?d\\252\\174{<\\SUBY^\\195\\221\\GSci_\\175\\147$+R\\136\\&7\\136\\156\\189\\DC3\\226\\165\\167{<\\DEL\\142\\234\\204\\a\\239X\\184\\DC1\\251\\216x\\146\\169\\167\\EM\\223\\234S\\SYN\\187\\143c\\205\\169n\\212v\\179\\194(y\\US\\157\\202\\190\\203e\\EMxR\\136\\&7\\138\\FS\\140\\v\\241\\&2\\227\\253\\225v\\134v\\251\\t\\155!?1\\186\\150%/}$t\\133!&\\134:\\210\\DC2S\\209>\\249\\&7e)\\188\\139\\235\\136:\\DLEE\\238\\165p\\201\\151\\&8\\DLE\\r%}J`\\STXh\\227\\194\\217{\\205\\154\\SYN\\195z\\DC2X\\218\\n#\\ENQd>8C\\164J\\247\\204\\159\\SI\\ETX\\133\\134\\140L\\t~!$\\224\\133\\248O\\165\\251}\\182\\f\\234\\198J\\130\\249\\178\\&1\\\\\\f\\SI'<\\231u2\\146\\187\\169/!\\CAN\\141\\156\\169Q\\213\\146\\232\\213\\139\\216v6\\134\\219w\\US\\144\\144s\\253\\156\\178\\&2\\157;{rs~_\\198n8E\\244\\149\\&0V}\\245\\ENQ\\171\\147\\252\\249\\188\\157\\aF\\128\\158\\165\\a^v*\\142m\\139 ^\\v\\186\\164s\\172\\CAN:\\158\\147\\207\\250.cg*9\\166q|M(\\151U)\\164\\166\\166!Y/\\132\\EOT\\188\\DLEo?\\245E6\\236\\136\\133{\\171\\233\\254Nmj\\215\\206\\243\\170\\249>s/\\167\\191\\132/\\181$`\\194B\\250:\\174\\229#\\255r\\184\\187Ue\\228\\137\\148\\236\\191\\153\\224\\&5l\\ETX\\171\\251\\216\\178\\161K\\r*V\\174\\203\\128}e\\EM\\177\\246Wz\\149\\205\\190g\\207\\172&\\227~\\RS\\141\\199\\250\\&6\\148\\178/\\142\\171oW\\246\\248\\SI\\165\\229\\179N-\\152x1pZ\\US\\202\\236\\238\\136\\151\\147\\GS66\\158\\f\\r\\147\\219\\228\\132(*\\DC4:\\157\\156X{U\\\"\\\"\\\"\\240\\244\\244\\148\\138x\\131\\168\\166\\EM\\179o\\DC1T\\218\\158\\134{I\\169\\SI!D\\209\\NAK\\EM\\EM\\137\\143\\143\\143\\180\\224\\133\\DLEB\\136\\183\\153\\EOT\\188\\DLEB\\b\\241\\SYN\\146\\219\\228\\132\\248\\a\\166\\173\\&3\\168\\230\\ETX\\150vR\\ETBB\\b\\tx!\\222\\SUB\\134\\238Z\\156\\220\\165\\RS\\132\\DLEo\\RS\\233\\162\\ETBB\\b!$\\224\\133\\248\\143\\138[G#\\179\\151;\\246\\185\\250\\248\\151\\148\\&6\\175\\201\\130\\CANM\\145(\\231\\229K`[\\ESC+\\172\\218l#A\\182\\&0!$\\224\\133x[\\233\\219U#\\248\\227\\230\\148\\&3S\\DC4\\137r^\\148V\\NAK\\193\\143}\\ESCQ>{hZ\\ESC\\151*\\EOTu\\251\\129\\DC3\\137rg\\174\\DLE\\175\\130\\156\\131\\ETB\\162\\136\\&0*\\221\\158\\144\\249E\\167\\156\\ETB\\162\\185\\205\\175\\157\\SUB\\211\\247D}\\190Y\\180\\155\\166e\\f\\137\\141\\ng\\231\\134s\\220T\\235\\168j\\161\\144\\NAK.\\132\\180\\224\\133x\\245t\\t\\DC1\\204\\237X\\141\\226J%J\\251*\\180\\159}\\138\\164'\\ESC\\158\\218x\\142\\205\\233N\\128\\187\\&5J\\165\\DC2s\\215:t_\\DLEA\\194c\\SI\\129O'\\242{o\\204+\\141d\\221\\143}\\bp\\179\\204j\\205V\\236\\194\\US\\SI\\179&L9\\242\\ENQ\\165s\\135\\128}\\186k=\\253\\194$|M\\203\\&0\\232x\\222\\167\\196%\\176\\167sq,\\234-$g\\242\\DEL+'\\167K\\220\\242\\157I\\132t\\170\\133\\187\\131\\EMJ\\171\\242\\188?\\237\\EOT\\ty\\150M\\151t\\154\\133\\157\\171g-{1_>\\157\\244\\GS\\181M\\vxz\\\"\\233\\&8\\203w&Q+d.C\\219\\212\\194\\219\\203\\159\\192\\214\\221\\249n\\241\\&4Z:<\\241\\179\\147\\SYN\\205\\154/\\STX(e\\166|\\230\\252\\144~\\157\\141#[P1\\187'\\160\\184\\239\\135\\140\\223u\\143\\204\\172\\133\\166\\175\\171\\NAK\\r\\DEL\\190\\251\\244\\179\\247\\&3\\163\\153U\\221\\130\\n\\255;M\\154l\\210B\\STX^\\b\\129N\\197\\222!-\\249r\\135+_\\239\\192\\251\\171\\DLEz\\212-\\139k\\229V|=\\165\\ETX\\246\\143\\133\\199Q&\\135D\\224=q9c\\130\\171Q\\182\\164\\ESCU\\219\\142!\\164\\181\\150\\205\\243\\SO\\240\\244\\224ke\\EM2{\\b\\141J[`\\168,\\134w\\211\\214x[\\230\\179\\155\\218\\208\\141\\214\\GS+q\\239\\247\\149\\156\\201~\\172\\188\\234\\232\\DC2v\\164T\\167\\235\\187N\\232\\ETBt\\249\\170\\244g\\240\\187%0R\\CAN\\227\\214\\162\\&3\\213\\244/\\176\\251Rv<&\\FSf\\214\\234;x\\DEL=\\141>\\245=(U\\161)\\195B>\\193\\177\\160\\223a^\\147\\&1s\\186R\\236\\151\\182\\148u(K\\173\\150\\157\\EM6c=\\167\\226\\&2\\159:\\224\\160|o&\\r|\\ETBo\\SIo\\154\\SI\\FSBm\\253\\200G\\243\\163>\\195\\210%\\ETB(\\209c\\SYN\\163ZzQ\\202\\205\\151v\\227f\\208\\222\\226\\CAN\\243W_\\\"]a\\129WP\\EM\\146\\142\\US\\226f\\ACK$\\RS\\155@\\231\\RS\\179\\&9\\151\\n\\234\\232?9\\147\\233I\\147\\nf\\178M\\v\\tx!\\EOTd\\220\\143$ZmM\\165*\\197r/R1-S\\ESC\\183<\\211d\\222\\v'<6\\131\\163\\189\\203b\\158\\219-\\238@\\243_\\227I\\189\\DEL\\DC3\\213\\DC3\\189\\227\\138\\146u\\168\\230\\240\\188\\151\\188\\CAN\\226\\218\\178#\\149\\US\\172g\\229\\153\\DC4@\\197\\209\\165;I\\173\\213\\141 \\199\\130\\198\\187\\STXC\\a7\\172sfE_\\137\\153A:\\137\\169Y}\\SO\\EM\\SI\\206q9\\217\\154\\202U\\FSr\\151\\221\\196\\173:\\174\\138\\130\\207s\\201\\247fq\\236\\246E\\254\\\\1\\130\\247*h\\t\\251\\161\\ETX5\\202\\181d\\214\\133\\180\\199\\231\\199\\165\\DC2\\142F\\217\\255\\&3\\178\\194\\218(#w~P_\\231\\212\\GS\\ENQ\\238u\\220Q\\230|\\196\\212\\131:\\165\\225F\\196MR1\\192\\169f]\\236c\\246r.1\\137\\211K\\SYN\\242\\203O\\243Xs)\\133\\135'\\SOp\\223\\165\\DC1\\190\\182\\242\\&3'$\\224\\133\\DLE\\NUL\\n\\ENQ\\160\\135\\129\\222\\163TS\\232\\ESC\\162\\255T\\200\\217\\240I\\232\\ETX\\212j\\245\\227\\175\\195\\189p{\\\"\\203\\245\\140\\205\\&1z\\129\\235\\202\\f\\\\Z\\208\\217\\251!\\235W\\158&Yu\\152%\\161\\233\\212\\238\\214\\144b\\207\\177\\a+\\244\\DC4O\\143K\\255\\146.lW\\152\\186P\\189eW\\134NZFh\\196^\\250\\217\\236e\\252\\228c$\\231\\157F_\\175\\192\\243\\147w\\136,\\165G#|\\f\\206\\179\\231\\204i\\182\\132\\185\\&2\\176\\135\\&9{\\254\\188\\196\\233\\208(\\204\\171\\aP\\202H6i!\\SOH/\\132\\NUL\\f\\237+R\\214L\\197\\165\\171I\\185\\231\\210\\211n\\158\\228V\\158P1p\\240\\197\\199&\\142\\131\\161Q\\164\\190\\138\\153\\&2(I\\179\\206>\\196mX\\193\\190]K" ] } ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In addition to displaying outputs in a rich format, IHaskell has a bunch of useful features.\n", "\n", "For instance, the popular linting tool `hlint` is integrated and turned on by default. Let's write some ugly code, and see what it tells us:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "-- There is also hlint integration enabled by default.\n", "-- If you write sketchy code, it will tell you:\n", "f :: Int -> Int\n", "f x = x + 1\n", "\n", "-- Most warnings are orange...\n", "f $ 3\n", "\n", "-- But more severe warnings are red.\n", "putStrLn (show 3)\n", "do\n", " return 3" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you're an experienced Haskeller, though, and don't want `hlint` telling you what to do, you can easily turn it off:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "-- If hlint annoys you, though, you can turn it off.\n", "-- Note that this only takes effect in the next cell execution.\n", ":opt no-lint" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [ "-- You could similarly use `:opt lint` to turn it back on.\n", "f $ 3" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In addition to `hlint` integration, IHaskell also integrates **Hoogle** for documentation searches. IHaskell provides two directives for searching Hoogle. The first of these, `:document` (or shorthands), looks for exact matches." ] }, { "cell_type": "code", "collapsed": false, "input": [ ":doc filterM" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Like with `:info`, the Hoogle directives use the IPython documentation pager to show you their output. You can press Escape to dismiss the pager. If you're reading this in it's HTML form, the output looks like this:\n", "\n", "![](https://raw2.github.com/gibiansky/IHaskell/master/demo/doc-demo.png)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The other provided command is `:hoogle`. This does a normal Hoogle search, and thus lets you use imperfect matching and searching by type signature." ] }, { "cell_type": "code", "collapsed": false, "input": [ ":hoogle :: [a] -> [(a, b)]" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The pager will show you documentation for things that could have that type signature or a similar one. It automatically formats inline Haskell code and hyperlinks the identifiers to their respective Haddock documentations:\n", "\n", "![](https://raw2.github.com/gibiansky/IHaskell/master/demo/hoogle-demo.png)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you need a refresher on all of the options, you can just use `:help`:" ] }, { "cell_type": "code", "collapsed": false, "input": [ ":help" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "All of the code you normally put into IHaskell is (like in GHCi) interpreted. However, sometimes you've perfected a function, and now need it to run faster. In that case, you can go ahead and define a module in a single cell. As long as your module has a module header along the lines of `module Name where`, IHaskell will recognize it as a module. It will create the file `A/B.hs`, compile it, and load it. " ] }, { "cell_type": "code", "collapsed": false, "input": [ "-- If your code isn't running fast enough, you can just put it into a module.\n", "module A.B where\n", "\n", "fib 0 = 1\n", "fib 1 = 1\n", "fib n = fib (n-1) + fib (n-2)" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Note that the module is by default imported unqualified, as though you had typed `import A.B`." ] }, { "cell_type": "code", "collapsed": false, "input": [ "-- The module is automatically imported unqualified.\n", "print $ A.B.fib 20\n", "print $ fib 20" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Note that since a new module is imported, all previous bound identifiers are now unbound. For instance, we no longer have access to the `f` function from before:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "f 3" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "However, if you re-import this module with another import statement, the original implicit import goes away." ] }, { "cell_type": "code", "collapsed": false, "input": [ "import qualified A.B as Fib\n", "\n", "Fib.fib 20\n", "fib 20" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Thanks!\n", "---\n", "\n", "That's it for now! I hope you've enjoyed this little demo of **IHaskell**! There are still a few features that I haven't covered, such as the `show-types` and `show-errors` options, as well as the relatively intelligent autocompletion mechanism and inline type info popups.\n", "\n", "I hope you find IHaskell useful, and please report any bugs or features requests [on Github](https://github.com/gibiansky/IHaskell/issues). If you have any comments, want to contribute, or just want to get in touch, don't hesitate to contact me at Andrew dot Gibiansky at Gmail. Contributions are also more than welcome, and I'm happy to help you get started with IHaskell development if you'd like to contribute!\n", "\n", "I am also often available at `#ihaskell` on IRC at `chat.freenode.net`, so if I'm around, don't hesitate to ask questions.\n", "\n", "Thank you to [Adam Vogt](https://github.com/aavogt), [Stian H\u00e5klev](http://reganmian.net/), and [@edechter](https://github.com/edechter) for their testing, bug reporting, pull requests, and general patience!" ] } ], "metadata": {} } ] }