Commit 904ee1fe authored by Diederik van Arkel's avatar Diederik van Arkel

add strictness annots to getLine(s)

parent a58ff24c
...@@ -27,7 +27,7 @@ validateLineNr :: !LineNr Text -> LineNr ...@@ -27,7 +27,7 @@ validateLineNr :: !LineNr Text -> LineNr
getLine :: !LineNr !u:Text -> (!String, !u:Text) getLine :: !LineNr !u:Text -> (!String, !u:Text)
getLineC :: !LineNr !u:Text -> ((!Info,!String), !u:Text) getLineC :: !LineNr !u:Text -> ((!Info,!String), !u:Text)
getLines :: LineNr LineNr Text -> (StrictList String, Text) getLines :: !LineNr !LineNr !Text -> (!StrictList String, !Text)
//getLinesC :: LineNr LineNr Text -> (StrictList (Int,String), Text) //getLinesC :: LineNr LineNr Text -> (StrictList (Int,String), Text)
updateLine :: !LineNr !String !.Text -> (!Int,!Int,!.Text) updateLine :: !LineNr !String !.Text -> (!Int,!Int,!.Text)
......
...@@ -101,6 +101,7 @@ where ...@@ -101,6 +101,7 @@ where
sSize (SCons string SNil) = size string sSize (SCons string SNil) = size string
sSize (SCons string rest) = size string + sizeNewline + sSize rest sSize (SCons string rest) = size string + sizeNewline + sSize rest
sUpdate :: !Int !*String !(StrictList String) -> *String
sUpdate i s SNil = s sUpdate i s SNil = s
sUpdate i s (SCons string SNil) sUpdate i s (SCons string SNil)
# (_,s) = sU (size string) i 0 s string # (_,s) = sU (size string) i 0 s string
...@@ -143,7 +144,7 @@ blocksToStrings :: ![StrictList (Info,String)] -> StrictList String ...@@ -143,7 +144,7 @@ blocksToStrings :: ![StrictList (Info,String)] -> StrictList String
blocksToStrings [] = SNil blocksToStrings [] = SNil
blocksToStrings [block:blocks] blocksToStrings [block:blocks]
= slAppend (blockToStrings block) (blocksToStrings blocks) = slAppend (blockToStrings block) (blocksToStrings blocks)
blocksToStringsC :: ![StrictList (Info,String)] -> StrictList (Info,String) blocksToStringsC :: ![StrictList (Info,String)] -> StrictList (Info,String)
blocksToStringsC [] = SNil blocksToStringsC [] = SNil
blocksToStringsC [block:blocks] blocksToStringsC [block:blocks]
...@@ -200,7 +201,7 @@ where ...@@ -200,7 +201,7 @@ where
// denotes by the line numbers. It also returns the number of // denotes by the line numbers. It also returns the number of
// the first block // the first block
getBlocks :: LineNr LineNr Text -> (Int, [StrictList (Info,String)]) getBlocks :: !LineNr !LineNr !Text -> (!Int, ![StrictList (Info,String)])
getBlocks first last { blocks } getBlocks first last { blocks }
= ( nrSkip = ( nrSkip
, blocks%(nrSkip,nrTake) , blocks%(nrSkip,nrTake)
...@@ -209,7 +210,7 @@ where ...@@ -209,7 +210,7 @@ where
nrSkip = first / BlockSize nrSkip = first / BlockSize
nrTake = last / BlockSize + 1 nrTake = last / BlockSize + 1
getLines :: LineNr LineNr Text -> (StrictList String, Text) getLines :: !LineNr !LineNr !Text -> (!StrictList String, !Text)
getLines first last text getLines first last text
= ( slTake (last - first + 1) = ( slTake (last - first + 1)
(slDrop first` (blocksToStrings blocks)) (slDrop first` (blocksToStrings blocks))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment