~singpolyma/xml-types-haskell

4eebb86a9fd41c274ec1c3bdec23e6057b1d545f — John Millikin 11 years ago adb1d7a
Remove mostly useless ``position`` function
1 files changed, 0 insertions(+), 9 deletions(-)

M Data/XML/Types.hs
M Data/XML/Types.hs => Data/XML/Types.hs +0 -9
@@ 56,7 56,6 @@ module Data.XML.Types
	, elementChildren
	, elementContent
	, hasAttribute
	, position
	) where
import Control.Monad ((>=>))
import Data.Text (Text)


@@ 207,13 206,5 @@ elementContent = elementNodes >=> isContent
nodeChildren :: Node -> [Node]
nodeChildren = isElement >=> elementNodes

position :: Integer -> (a -> [b]) -> a -> [b]
position n f e = safeHead n (f e)

safeHead :: Integer -> [a] -> [a]
safeHead _ [] = []
safeHead 0 (x:_) = [x]
safeHead n (_:xs) = safeHead (n - 1) xs

hasAttribute :: (Attribute -> [Attribute]) -> Element -> [Element]
hasAttribute f e = [e | not $ null (elementAttributes e >>= f)]