Changeset 192
- Timestamp:
- Jan 24, 2008, 7:04:30 PM (18 years ago)
- Author:
- neil.c.c.brown
- Message:
-
Added a section on where to look for useful Haskell functions
- File:
-
- 1 edited
- docs/trunk/hacking-guide/tock-intro.tex (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
docs/trunk/hacking-guide/tock-intro.tex
r191 r192 456 456 457 457 \section{Add Your Own Code} 458 (追記) (追記ここまで) 459 (追記) \subsection{Conventions} (追記ここまで) 458 460 459 461 Tock, as a project, does not have any particular coding conventions. Lists of module imports should be … … 506 508 good way to go about it. 507 509 510 (追記) \subsection{Be Lazy (it's the Haskell way)} (追記ここまで) 511 (追記) (追記ここまで) 512 (追記) Try and make your life easy by coding as little as possible. Check the Utils module (and the TestUtils (追記ここまで) 513 (追記) module when testing) as well as other modules (such as Types) to see if there is an existing function (追記ここまで) 514 (追記) that does what you need. Anything that seems likely to have been needed before (such as getting the (追記ここまで) 515 (追記) type of a variable) probably has been. (追記ここまで) 516 (追記) (追記ここまで) 517 (追記) The Utils (and to a lesser extent TestUtils) module are intended to contain functions that could have (追記ここまで) 518 (追記) come straight out of the standard library. The standard library is also another place to look for (追記ここまで) 519 (追記) useful functions. The URL for the latest version is: \url{http://haskell.org/ghc/docs/latest/html/libraries/}. (追記ここまで) 520 (追記) Particularly useful modules are\footnote{The URLs are a bit fragile for the latest version, but (追記ここまで) 521 (追記) they are easy enough to find by searching the contents page from the URL given here}: (追記ここまで) 522 (追記) (追記ここまで) 523 (追記) \begin{itemize} (追記ここまで) 524 (追記) \item \lstinline|Data.List| -- Contains various helper functions for dealing with lists, including map, (追記ここまで) 525 (追記) foldl, zip, sum, and many others\footnote{A lot of these are technically in the standard Prelude, but (追記ここまで) 526 (追記) it's easy to find all the documentation in one place in the \lstinline|Data.List| module, as well (追記ここまで) 527 (追記) as several useful functions not in the Prelude.}. Probably the most useful module. (追記ここまで) 528 (追記) \item \lstinline|Control.Monad| -- Contains all the general monadic helper functions, such as (追記ここまで) 529 (追記) mapM, foldM, sequence. If you ever find yourself struggling to manipulate monadic types, there (追記ここまで) 530 (追記) may be something to help you in here. (追記ここまで) 531 (追記) \item \lstinline|System.IO| -- Contains all the functions for printing to the screen, reading from (追記ここまで) 532 (追記) files, etc. (追記ここまで) 533 (追記) \end{itemize} (追記ここまで) 534 (追記) (追記ここまで) 535 (追記) Other useful modules are \lstinline|Data.Maybe|, \lstinline|Data.Generics|, \lstinline|Data.Map|, (追記ここまで) 536 (追記) \lstinline|Data.Set| and \lstinline|Test.HUnit|. (追記ここまで) 537 (追記) (追記ここまで) 508 538 \section{Test Your Code} 509 539
Note:
See TracChangeset
for help on using the changeset viewer.