# Ticket #5565: session-2.txt

File session-2.txt, 8.3 KB (added by porges, 19 months ago)

my ghci session

Line
1                  -> Word16
2                  -> Word16
3                  -> Word16
5    has only 8
6    In the first argument of `print', namely
7      `(IPv6Address 1 0 0 1 0 0 0 1 0)'
8    In the expression: print (IPv6Address 1 0 0 1 0 0 0 1 0)
9    In an equation for `it': it = print (IPv6Address 1 0 0 1 0 0 0 1 0)
10*Main> print (IPv6Address 1 0 0 1 0 0 0 1)
111:::1:::1
12*Main> :r
13[1 of 1] Compiling Main             ( IpAddress.hs, interpreted )
15*Main> print (IPv6Address 1 0 0 1 0 0 0 1)
161::1::1
17*Main> let longestZeroSeq parts = groupBy ((==) `on` fst) zip parts [0..]
18
19<interactive>:1:42: Not in scope: `on'
20*Main> import Data.Function
21*Main Data.Function> let longestZeroSeq parts = groupBy ((==) `on` fst) zip part
22s [0..]
23
24<interactive>:1:28:
25    The function `groupBy' is applied to four arguments,
26    but its type `(a0 -> a0 -> Bool) -> [a0] -> [[a0]]' has only two
27    In the expression: groupBy ((==) `on` fst) zip parts [0 .. ]
28    In an equation for `longestZeroSeq':
29        longestZeroSeq parts = groupBy ((==) `on` fst) zip parts [0 .. ]
30*Main Data.Function> let longestZeroSeq parts = groupBy ((==) `on` fst) (zip par
31ts [0..])
32*Main Data.Function> longestZeroSeq [1,2,0,0,0,1,0,0,2,0,0,0,0]
33[[(1,0)],[(2,1)],[(0,2),(0,3),(0,4)],[(1,5)],[(0,6),(0,7)],[(2,8)],[(0,9),(0,10)
34,(0,11),(0,12)]]
35*Main Data.Function> longestZeroSeq = fst \$ maxBy length \$ filter ((==0) . fst .
36 head) \$ groupBy ((==) `on` fst) \$ zip parts [0..]
37
38<interactive>:1:16: parse error on input `='
39*Main Data.Function> let longestZeroSeq = fst \$ maxBy length \$ filter ((==0) . f
40st . head) \$ groupBy ((==) `on` fst) \$ zip parts [0..]
41
42<interactive>:1:28: Not in scope: `maxBy'
43
44<interactive>:1:103: Not in scope: `parts'
45*Main Data.Function> let longestZeroSeq parts = fst \$ maximumBy length \$ filter
46((==0) . fst . head) \$ groupBy ((==) `on` fst) \$ zip parts [0..]
47
48<interactive>:1:44:
49    Couldn't match expected type `[a0] -> Ordering'
50                with actual type `Int'
51    Expected type: [a0] -> [a0] -> Ordering
52      Actual type: [a0] -> Int
53    In the first argument of `maximumBy', namely `length'
54    In the expression: maximumBy length
55*Main Data.Function> let longestZeroSeq parts = fst \$ maximumBy (comparing.lengt
56h) \$ filter ((==0) . fst . head) \$ groupBy ((==) `on` fst) \$ zip parts [0..]
57
58<interactive>:1:45: Not in scope: `comparing'
59*Main Data.Function> import Data.List
60*Main Data.Function Data.List> let longestZeroSeq parts = fst \$ maximumBy (compa
61ring.length) \$ filter ((==0) . fst . head) \$ groupBy ((==) `on` fst) \$ zip parts
62 [0..]
63
64<interactive>:1:45: Not in scope: `comparing'
65*Main Data.Function Data.List> import Data.Ord
66*Main Data.Function Data.List Data.Ord> let longestZeroSeq parts = fst \$ maximum
67By (comparing.length) \$ filter ((==0) . fst . head) \$ groupBy ((==) `on` fst) \$
68zip parts [0..]
69
70<interactive>:1:45:
71    Couldn't match expected type `Ordering'
72                with actual type `a0 -> Ordering'
73    Expected type: (a0 -> a1) -> a0 -> Ordering
74      Actual type: (a0 -> a1) -> a0 -> a0 -> Ordering
75    In the first argument of `(.)', namely `comparing'
76    In the first argument of `maximumBy', namely `(comparing . length)'
77*Main Data.Function Data.List Data.Ord> let longestZeroSeq parts = fst \$ maximum
78By (comparing length) \$ filter ((==0) . fst . head) \$ groupBy ((==) `on` fst) \$
79zip parts [0..]
80
81<interactive>:1:34:
82    Couldn't match expected type `(a0, b0)'
83                with actual type `[(b1, b2)]'
84    In the second argument of `(\$)', namely
85      `maximumBy (comparing length)
86     \$   filter ((== 0) . fst . head)
87       \$   groupBy ((==) `on` fst) \$ zip parts [0 .. ]'
88    In the expression:
89        fst
90      \$   maximumBy (comparing length)
91        \$   filter ((== 0) . fst . head)
92          \$   groupBy ((==) `on` fst) \$ zip parts [0 .. ]
93    In an equation for `longestZeroSeq':
94        longestZeroSeq parts
95          = fst
96          \$   maximumBy (comparing length)
97            \$   filter ((== 0) . fst . head)
98              \$   groupBy ((==) `on` fst) \$ zip parts [0 .. ]
99*Main Data.Function Data.List Data.Ord> let longestZeroSeq parts = maximumBy (co
100mparing length) \$ filter ((==0) . fst . head) \$ groupBy ((==) `on` fst) \$ zip pa
101rts [0..]
102*Main Data.Function Data.List Data.Ord> longestZeroSeq [1,0,0,0,0,0,1,0,0,1,0]
103[(0,1),(0,2),(0,3),(0,4),(0,5)]
104*Main Data.Function Data.List Data.Ord> let longestZeroSeq parts = \$ maximumBy (
105comparing length) \$ filter ((==0) . fst . head) \$ groupBy ((==) `on` fst) \$ zip
106parts [0..]
107*Main Data.Function Data.List Data.Ord> :r
108[1 of 1] Compiling Main             ( IpAddress.hs, interpreted )
109
111
113    Illegal view pattern:  length -> maxZeroLen
114    Use -XViewPatterns to enable view patterns
115
117    Illegal view pattern:  snd . head -> maxZeroAt
118    Use -XViewPatterns to enable view patterns
119
121
124Prelude Data.Function Data.List Data.Ord> r
125
126<interactive>:1:1: Not in scope: `r'
127Prelude Data.Function Data.List Data.Ord> :r
128[1 of 1] Compiling Main             ( IpAddress.hs, interpreted )
129
131
134Prelude Data.Function Data.List Data.Ord>
135ghc.exe: panic! (the 'impossible' happened)
136  (GHC version 7.0.3 for i386-unknown-mingw32):
137        thread blocked indefinitely in an MVar operation
138
140
141
143GHCi, version 7.0.3: http://www.haskell.org/ghc/  :? for help
148[1 of 1] Compiling Main             ( IpAddress.hs, interpreted )
149
151
154Prelude> :l test.hs
155[1 of 1] Compiling Main             ( test.hs, interpreted )
156
157test.hs:3:44: Not in scope: `maximumBy'
158
159test.hs:3:55: Not in scope: `comparing'
160
161test.hs:3:105: Not in scope: `groupBy'
162
163test.hs:3:119: Not in scope: `on'
164
165test.hs:3:135: Not in scope: `parts'
167Prelude> :r
168[1 of 1] Compiling Main             ( test.hs, interpreted )
169
170test.hs:6:119: Not in scope: `on'
171
172test.hs:6:135: Not in scope: `parts'
174Prelude> :r
175[1 of 1] Compiling Main             ( test.hs, interpreted )
176
177test.hs:7:119: Not in scope: `on'
179Prelude> :q
180Leaving GHCi.
181
183GHCi, version 7.0.3: http://www.haskell.org/ghc/  :? for help
188[1 of 1] Compiling Main             ( IpAddress.hs, interpreted )
189
191
194Prelude> :r
195[1 of 1] Compiling Main             ( IpAddress.hs, interpreted )
196
198
201Prelude> :r
202[1 of 1] Compiling Main             ( IpAddress.hs, interpreted )
203
205
207    Illegal view pattern:  length -> maxZeroLen
208    Use -XViewPatterns to enable view patterns
209
211    Illegal view pattern:  snd . head -> maxZeroAt
212    Use -XViewPatterns to enable view patterns
213
216Prelude> :r
217[1 of 1] Compiling Main             ( IpAddress.hs, interpreted )
218