on efbaec8 help sign in
text/Data/Text/Internal/Functions.hs
31 lines 821 B history raw
1{-# LANGUAGE CPP, DeriveDataTypeable #-}
3-- |
4-- Module : Data.Text.Internal.Functions
5-- Copyright : 2010 Bryan O'Sullivan
6--
7-- License : BSD-style
8-- Maintainer : bos@serpentine.com
9-- Stability : experimental
10-- Portability : GHC
11--
12-- /Warning/: this is an internal module, and does not have a stable
13-- API or name. Functions in this module may not check or enforce
14-- preconditions expected by public modules. Use at your own risk!
15--
16-- Useful functions.
18module Data.Text.Internal.Functions
19 (
20 intersperse
21 ) where
23-- | A lazier version of Data.List.intersperse. The other version
24-- causes space leaks!
25intersperse :: a -> [a] -> [a]
26intersperse _ [] = []
27intersperse sep (x:xs) = x : go xs
28 where
29 go [] = []
30 go (y:ys) = sep : y: go ys
31{-# INLINE intersperse #-}