remove uses of head/tail
This commit is contained in:
parent
8daa6fa09f
commit
20963afa17
4 changed files with 81 additions and 37 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue