GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> filter (\c -> c < 'm') "the quick brown fox jumps over the lazy dog" "he ick b f j e he la dg" Prelude> map (\x -> 100+x) [2,5,8,9] [102,105,108,109] Prelude> 12 + 3 15 Prelude> (+) 12 3 15 Prelude> (+1) 13 14 Prelude> map (+100) [2,5,8,9] [102,105,108,109] Prelude> filter (<'m') "the quick brown fox jumps over the lazy dog" "he ick b f j e he la dg" Prelude> filter ('m'<=) "the quick brown fox jumps over the lazy dog" "tqurownoxumpsovrtzyo" Prelude> :(^) unknown command ':(^)' use :? for help. Prelude> :t (^) (^) :: (Num a, Integral b) => a -> b -> a Prelude> :l foo.hs [1 of 1] Compiling Main ( foo.hs, interpreted ) Ok, modules loaded: Main. *Main> hypot 3 4 5.0 *Main> :l foo.hs [1 of 1] Compiling Main ( foo.hs, interpreted ) foo.hs:4:0: parse error (possibly incorrect indentation) Failed, modules loaded: none. Prelude> :l foo.hs [1 of 1] Compiling Main ( foo.hs, interpreted ) Ok, modules loaded: Main. *Main> :l foo.hs [1 of 1] Compiling Main ( foo.hs, interpreted ) Ok, modules loaded: Main. *Main> quadr 1 5 10 [NaN,NaN] *Main> sqrt (-10) NaN *Main> quadr 1 -5 10 :1:0: No instance for (Num (t -> t -> [t])) arising from a use of `-' at :1:0-12 Possible fix: add an instance declaration for (Num (t -> t -> [t])) In the expression: quadr 1 - 5 10 In the definition of `it': it = quadr 1 - 5 10 :1:9: No instance for (Num (t1 -> t -> t -> [t])) arising from the literal `5' at :1:9-12 Possible fix: add an instance declaration for (Num (t1 -> t -> t -> [t])) In the second argument of `(-)', namely `5 10' In the expression: quadr 1 - 5 10 In the definition of `it': it = quadr 1 - 5 10 *Main> quadr 1 (-5) 10 [NaN,NaN] *Main> quadr 1 (-5) (-10) [6.531128874149275,-1.5311288741492746] *Main> :l foo.hs [1 of 1] Compiling Main ( foo.hs, interpreted ) Ok, modules loaded: Main. *Main> if ('x' < 'z') then "YES!" else "NO!!!" "YES!" *Main> :l foo.hs [1 of 1] Compiling Main ( foo.hs, interpreted ) Ok, modules loaded: Main. *Main> fib 10 89 *Main> map fib [0..10] [1,1,2,3,5,8,13,21,34,55,89] *Main> map fib [0..50] [1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811,514229,832040,1346269,2178309,3524578,5702887, C-c C-cInterrupted. *Main> :t (:) (:) :: a -> [a] -> [a] *Main> 'f':['o','o','b'] "foob" *Main> 1:[10..15] [1,10,11,12,13,14,15] *Main> map ('X':) ["the","quick","brown"] ["Xthe","Xquick","Xbrown"] *Main> zipWith (+) [1,2,3] [100,200,300] [101,202,303] *Main> zipWith (++) ["the","quick","brown"] ["fox","jumps","over"] ["thefox","quickjumps","brownover"] *Main> :t tl :1:0: Not in scope: `tl' *Main> :t tail tail :: [a] -> [a] *Main> tail [1..9] [2,3,4,5,6,7,8,9] *Main> :l foo.hs [1 of 1] Compiling Main ( foo.hs, interpreted ) Ok, modules loaded: Main. *Main> take 10 fiblist [1,1,2,3,5,8,13,21,34,55] *Main> take 10 fiblist' [1,1,2,3,5,8,13,21,34,55] *Main> fiblist !! 100 573147844013817084101 *Main> fiblist !! 1000 70330367711422815821835254877183549770181269836358732742604905087154537118196933579742249494562611733487750449241765991088186363265450223647106012053374121273867339111198139373125598767690091902245245323403501 *Main> fiblist !! 10000 54438373113565281338734260993750380135389184554695967026247715841208582865622349017083051547938960541173822675978026317384359584751116241439174702642959169925586334117906063048089793531476108466259072759367899150677960088306597966641965824937721800381441158841042480997984696487375337180028163763317781927941101369262750979509800713596718023814710669912644214775254478587674568963808002962265133111359929762726679441400101575800043510777465935805362502461707918059226414679005690752321895868142367849593880756423483754386342639635970733756260098962462668746112041739819404875062443709868654315626847186195620146126642232711815040367018825205314845875817193533529827837800351902529239517836689467661917953884712441028463935449484614450778762529520961887597272889220768537396475869543159172434537193611263743926337313005896167248051737986306368115003088396749587102619524631352447499505204198305187168321623283859794627245919771454628218399695789223798912199431775469705216131081096559950638297261253848242007897109054754028438149611930465061866170122983288964352733750792786069444761853525144421077928045979904561298129423809156055033032338919609162236698759922782923191896688017718575555520994653320128446502371153715141749290913104897203455577507196645425232862022019506091483585223882711016708433051169942115775151255510251655931888164048344129557038825477521111577395780115868397072602565614824956460538700280331311861485399805397031555727529693399586079850381581446276433858828529535803424850845426446471681531001533180479567436396815653326152509571127480411928196022148849148284389124178520174507305538928717857923509417743383331506898239354421988805429332440371194867215543576548565499134519271098919802665184564927827827212957649240235507595558205647569365394873317659000206373126570643509709482649710038733517477713403319028105575667931789470024118803094604034362953471997461392274791549730356412633074230824051999996101549784667340458326852960388301120765629245998136251652347093963049734046445106365304163630823669242257761468288461791843224793434406079917883360676846711185597501 *Main> :t take take :: Int -> [a] -> [a] *Main> take 10 [100..1000] [100,101,102,103,104,105,106,107,108,109] *Main> map (take 2) ["the","quick","brown","fox"] ["th","qu","br","fo"] *Main> :l foo.hs [1 of 1] Compiling Main ( foo.hs, interpreted ) Ok, modules loaded: Main. *Main> len [1..1000] 1000 *Main> :l foo.hs [1 of 1] Compiling Main ( foo.hs, interpreted ) Ok, modules loaded: Main. *Main> len [1..10000] 10000 *Main> len [(1/0),(2/0)] 2 *Main> head [(1/0),(2/0)] Infinity Prelude> :t (==) (==) :: (Eq a) => a -> a -> Bool Prelude> :l foo.hs [1 of 1] Compiling Main ( foo.hs, interpreted ) Ok, modules loaded: Main. *Main> len' ([0..10] ++ [100..1000]) 912 *Main> [1,1,2,3] ++ [10,11] [1,1,2,3,10,11] *Main>