Difference between revisions of "Cookbook/Interactivity"
< Cookbook
Jump to navigation
Jump to search
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | = |
+ | == Input and output == |
⚫ | |||
⚫ | |||
⚫ | |||
− | Foo bar baz |
||
− | "Foo bar baz" |
||
⚫ | |||
+ | {| class="wikitable" |
||
⚫ | |||
+ | |- |
||
− | Strings can be output in a number of different ways. |
||
+ | ! Problem |
||
⚫ | |||
+ | ! Solution |
||
+ | ! Examples |
||
+ | |- |
||
+ | | printing a string |
||
+ | | [http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v%3AputStr putStr] |
||
⚫ | |||
Prelude> putStr "Foo" |
Prelude> putStr "Foo" |
||
FooPrelude> |
FooPrelude> |
||
</haskell> |
</haskell> |
||
+ | |- |
||
⚫ | |||
+ | | printing a string with a newline character |
||
− | <haskell> |
||
⚫ | |||
− | Prelude> putStr "Foo\n" |
||
⚫ | |||
− | Foo |
||
− | </haskell> |
||
⚫ | |||
− | <haskell> |
||
Prelude> putStrLn "Foo" |
Prelude> putStrLn "Foo" |
||
Foo |
Foo |
||
+ | Prelude> |
||
</haskell> |
</haskell> |
||
+ | |- |
||
− | We can also use [http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v%3Aprint print] to print a string, '''including the quotation marks.''' |
||
⚫ | |||
− | <haskell> |
||
⚫ | |||
− | Prelude> print "Foo" |
||
⚫ | |||
− | "Foo" |
||
⚫ | |||
+ | Foo bar baz --> "Foo bar baz" |
||
</haskell> |
</haskell> |
||
+ | |} |
||
+ | |||
+ | |||
− | = Parsing command line arguments = |
+ | == Parsing command line arguments == |
TODO |
TODO |