{- |
Conversion from HaXml position to our Position type.
We cannot convert back efficiently,
since we would have to increment the line number repeatedly.
Thus such a conversion is missing.
-}
module Text.XML.WraXML.Position.HaXml where

import           Text.XML.HaXml.Posn (Posn, posnColumn, posnLine, posnFilename, )

import qualified Text.XML.Basic.Position as Pos


{-
fromPosition :: Pos.T -> Posn
fromPosition p =
   Pn (Pos.fileName p) (Pos.row p) (Pos.column p) Nothing
-}

toPosition :: Posn -> Pos.T
toPosition :: Posn -> T
toPosition Posn
p =
   FileName -> Int -> Int -> T
Pos.new (Posn -> FileName
posnFilename Posn
p) (forall a. Enum a => a -> a
pred forall a b. (a -> b) -> a -> b
$ Posn -> Int
posnLine Posn
p) (forall a. Enum a => a -> a
pred forall a b. (a -> b) -> a -> b
$ Posn -> Int
posnColumn Posn
p)