Haskell

From BarikWiki
Jump to: navigation, search
  • Learn You a Haskell. Direct link to online book. After that, you can take a look at Real World Haskell, as well as Programming in Haskell. H-99 is based off of L-99: Ninety-Nine Lisp Problems, which in turn in based of a Prolog problem set.
  • Other Haskell Tutorials, which includes H-99: Ninety-Nine Haskell Problems.
  • Download Haskell. An interesting browsed based Haskell: Try Haskel!
  • You can run haskell in non-interactive mode, but without compilation using runhaskell -f. Use runhaskell --help to show additional options.
  • WinGHCi is my preferred environment for Windows. It has some special features that let you have a non-blocking edit command (add & in front of the editor).
  • There is an annoying bug in the UltraEdit wordfile. It prevents functions with an apostrophe (') from highlighting correctly. For now, you can change String Chars = "' to String Chars = "'. However, character literals will no longer be highlighted with this fix.
  • Haskell specifications.
  • Type declarations are right associative. So: (a -> b -> c) -> (b -> a -> c) is really (a -> b -> c) -> (b -> (a -> c)) which is really just (a -> b -> c) -> b -> a -> c.
  • Haskell Hierarchical Libraries. See the section on modules if you've forgotten how to use these.
  • Some common ways to import: import Data.List, import Data.List (nub, sort), import Data.List hiding (nub), import qualified Data.Map as M.
  • You can't define new types in GHCi, but no one is really sure why. The decision seems arbitrary. If you need new types, create a file and load it.
  • Differences between value constructors and type constructors. Example of type constructor: data Maybe a = Nothing | Just a. When you see data you should think of it as "data type".
  • The type keyword doesn't actually create types. It just makes synonyms like type String = [Char].
  • You could have invented Monads!

Monads

What are the pre-requisites for learning monads?

UltraEdit Haskell Syntax Highlighting Bug

Response from UltraEdit:

Thank you for your message. I have added this to our issue tracking system as an enhancement to be considered for a future release. Currently there isn't a way to support both behaviors. You would have to choose which you feel is most proper for Haskell - supporting the single quote for string characters or not.