-
Notifications
You must be signed in to change notification settings - Fork 256
Home
-
CaffeGraph Demo
a Haskell DSL for deep learning networks -
Haskell and cosmology
Using units and dimensions in a type-checked fashion, also some graphs - Hakaru, embedded probabilistic DSL
- Homophony groups
- Arrays and imperative programming
- Parsec
- Copy/Paste puzzle
- Understanding Applicative
- Finger trees
- Functional images
- K corrections
IHaskell is based upon the IPython architecture and frontend, so learning about that will help. You can write your own extensions using the IPython javascript API, for instance. Use h
to learn more about the modal interface IHaskell/IPython provides.
IHaskell adds a few features on top of the IPython frontends, such as automatic character concealing (typing ->
yields an arrow) and input cell folding (via the left and right arrow keys, or the buttons). If input cell folding isn't showing up, you can explicitly enable it via the "Cell Toolbar" (select 'Hiding').
IHaskell looks for notebook files (with the extension .ipynb) in ~/.ihaskell/notebooks
by default. You can change that via ihaskell notebook --serve=directory
or equivalent ihaskell notebook -s directory
.
The working directory of the scripts defaults to wherever you're running the ipython instance from. You can change that via :!cd my_new_dir
.
You can run simple shell commands with :!cmd
, for example :!cd /
. The shell is persistent (ie. if you cd
somewhere in one cell, and ls
in the next, it will be in the directory you went to).
If you want to include values from Haskell, you can use a quasiquoter (via :set -XQuasiQuotes
). For instance, using System.ShQQ
, you could write something like
let x = "foo bar" in [sh| cat $x |]
Many of the directives are shared with GHCi for the sake of convenience, though they do not necessarily behave in the exact same ways.
Use :set
to set flags (like GHCi set
) and :ext
to enable or disable extensions. (See below for more detail). :opt
can be used to set IHaskell-specific options, such as :set no-pager
.
:type
or :t
is similar to that in GHCi, and shows the type of an expression.
:kind
or :k
is similar to that in GHCi, and shows the kind of a type. However, :kind!
is not available at the moment; file an issue if that is important to you.
Example: :extension DataKinds NoExtendedDefaultRules
Alternative: :set -XDataKinds -XNoExtendedDefaultRules
You can use :set
in a similar manner to GHCi, e.g., set -XDataKinds
.
Default off. Shows types of return values (similar to :set +t
in GHCi).
Default on. Uses HLint to show suggestions for improvements.
Default on. Images from supporting libraries (such as Chart
and Diagrams
) are shown as SVG in the notebook. SVG images cannot at the moment be resized by the user clicking an dragging on a handle. When no-svg
is set, displays use PNG instead, which can be resized in the notebook.
Default off. By default, errors due to evaluating expressions that don't have a Show
instance are displayed as an unshowable
button:
When clicked, it displays the whole Show
error message.
To disable this and just show the error message by default (no button), use :opt show-errors
.
Default on. By default, things such as :info
and :doc
go to the IPython pager. However, if you'd like them to persist, you can instead direct them into the output area of the cell via :opt no-pager
.