module Utils where

import Data.Maybe
import Data.Char
import Data.List

cross f g (a, b) = (f a, g b)

showlist sh sep [] = ""
showlist sh sep (t1:ts) = sh t1 ++ concat [sep ++ sh t | t <- ts]

separate sep [] = []
separate sep (t1:ts) = t1 : concat [[sep, t] | t <- ts]

breaks2' p [] = []
breaks2' p (x:xs)
   | p x = (x, ys) : ws
   where (ys, zs) = break p xs
         ws = breaks2' p zs

breaks2 p xs
   = (ys, breaks2' p zs)
   where
   (ys, zs) = break p xs
