+instance Buffer (JoinList (Score, Size) String) where
+ toString = unlines . jlToList
+
+ fromString s = let ls = lines s in
+ foldr (+++) Empty $ map (\x -> Single (scoreString x, Size 1) x) ls
+ line n b = indexJ n b
+ replaceLine n l b = let pre = takeJ (n - 1) b
+ post = dropJ n b
+ (Append m1 _ _) = scoreLine l
+ in
+ pre +++ (Single (m1, Size (length l)) l) +++ post
+ numLines = \x -> case x of
+ Empty -> 0
+ Single _ _ -> 1
+ Append _ l r -> numLines l + numLines r
+
+ value = \x -> case x of
+ Empty -> 0
+ Single (_, m2) _ -> getSize . size $ m2
+ Append (_, m2) _ _ -> getSize . size $ m2
+
+main = runEditor editor $ Single (Score 244,Size 177) "This buffer is for notes you don't want to save, and for evaluation of steam valve coefficients. To load a different file, type the character L followed by the name of the file."
+-- [ "This buffer is for notes you don't want to save, and for"
+-- , "evaluation of steam valve coefficients."
+-- , "To load a different file, type the character L followed"
+-- , "by the name of the file."
+-- ]
+-- "This buffer is for notes you don't want to save, and for evaluation of steam valve -- coefficients. To load a different file, type the character L followed by the name of the file."