Functional coverage tree: Difference between revisions

Content added Content deleted
m (→‎{{header|Haskell}}: ( No need for Coverage to derive Eq ))
m (→‎{{header|Haskell}}: (Slight generalisation of `indentLevelsFromLines`))
Line 356: Line 356:
import Control.Arrow ((&&&), first)
import Control.Arrow ((&&&), first)
import Numeric (showFFloat)
import Numeric (showFFloat)
import Data.Char (isSpace)
import Data.Bool (bool)
import Data.Bool (bool)
import Data.Tree
import Data.Tree
Line 429: Line 430:
indentLevelsFromLines :: [T.Text] -> [(Int, T.Text)]
indentLevelsFromLines :: [T.Text] -> [(Int, T.Text)]
indentLevelsFromLines xs =
indentLevelsFromLines xs =
let pairs = T.span (' ' ==) <$> xs
let pairs = T.span isSpace <$> xs
indentUnit =
indentUnit =
foldr
foldr