fork download
  1. triangulate (x:a:b:xs) = scanl (\(x, a, b) n -> (x, b, n)) xs (x, a, b)
  2. main = print $ triangulate $ [1, 2, 3, 4, 5, 6, 7]
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
[1 of 1] Compiling Main             ( prog.hs, prog.o )

prog.hs:1:59:
    Couldn't match expected type `(t, b, b)'
           against inferred type `[t1]'
    In the second argument of `scanl', namely `xs'
    In the expression: scanl (\ (x, a, b) n -> (x, b, n)) xs (x, a, b)
    In the definition of `triangulate':
        triangulate (x : a : b : xs)
                      = scanl (\ (x, a, b) n -> (x, b, n)) xs (x, a, b)
stdout
Standard output is empty