print begin
build / build (push) Successful in 1m13s

This commit is contained in:
2026-08-21 16:25:04 -06:00
parent 66386cda64
commit c340ede84f
11 changed files with 76 additions and 13 deletions
+17 -1
View File
@@ -1,5 +1,6 @@
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ApplicativeDo #-}
module Gyehoek.Sexp.Syntax
( DatumF(..)
, Simple(..)
@@ -22,7 +23,10 @@ module Gyehoek.Sexp.Syntax
, pattern Vector
, pattern DotList
, pattern Gyehoek.Sexp.Syntax.List
, syntax
, indentation
, adorn
, indentWith
, pattern Bytevector
, pattern Symbol
, pattern String
@@ -36,7 +40,7 @@ import Data.Scientific (Scientific)
import Data.ByteString (ByteString)
import Gyehoek.Prelude hiding ((:<), Simple)
import Text.Megaparsec.Pos (SourcePos(..))
import Control.Comonad.Cofree (Cofree((:<)))
import Control.Comonad.Cofree (Cofree((:<)), _extract)
import Data.Fix (Fix (..))
import Data.Functor.Foldable
import Text.Show.Deriving (deriveShow1)
@@ -112,9 +116,21 @@ data Syn
deriveShow1 ''CompoundF
deriveShow1 ''DatumF
syntax :: Lens' Datum Syn
syntax = _extract
indentation :: Traversal' Datum Indentation
indentation k (syn :< CompoundF (ListF ind xs)) = do
ind' <- k ind
pure $ syn :< CompoundF (ListF ind' xs)
indentation k a = pure a
adorn :: Syn -> Datum -> Datum
adorn syn (_ :< d) = syn :< d
indentWith :: Indentation -> Datum -> Datum
indentWith = set indentation
pattern Simple :: Simple -> Datum
pattern Simple a <- _ :< SimpleF a
where Simple a = SynNone :< SimpleF a