remove uses of head/tail

This commit is contained in:
rhiannon morris 2024-07-08 02:47:18 +02:00
parent 8daa6fa09f
commit 20963afa17
4 changed files with 81 additions and 37 deletions

View file

@ -19,6 +19,7 @@ import qualified Data.Text.Lazy as LText
import Data.Text.Lazy (toStrict)
import Data.Foldable
import Data.Semigroup
import Data.List.NonEmpty (NonEmpty)
data ChunkType = Lit | Var VarType deriving Show
data VarType =
@ -188,3 +189,7 @@ deriving via ShowBuild Integer instance CanBuild Integer
instance {-# OVERLAPPABLE #-} CanBuild a => CanBuild [a] where
build = foldMap \x -> build x <> "\n"
reindent n = fold . intersperse ("\n" <> replicateB n ' ') . map build
instance CanBuild a => CanBuild (NonEmpty a) where
build = build . toList
reindent n = reindent n . toList