more stackification
build / build (push) Successful in 1m15s

This commit is contained in:
2026-08-18 16:13:44 -06:00
parent d91e059a84
commit 1c13de4153
12 changed files with 252 additions and 39 deletions
+7 -11
View File
@@ -8,6 +8,7 @@
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE OrPatterns #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE DeriveAnyClass #-}
module Gyehoek.Scheme.Syntax
( Name(..)
, Prim(..)
@@ -36,7 +37,7 @@ import Language.SexpGrammar qualified as Sexp
import Language.Sexp.Located qualified as S
import Language.SexpGrammar.Generic
import Effectful
import GHC.Generics
import GHC.Generics (Generic)
import Prelude hiding ((.), id)
import Control.Category
import Data.List.NonEmpty (NonEmpty)
@@ -61,6 +62,10 @@ import qualified Effectful.FileSystem.IO.ByteString as FB
newtype Name = MkName { inner :: Text }
deriving newtype (Show, Eq, Ord, IsString, Gen, Hashable)
deriving stock (Generic, Data)
deriving anyclass (Wrapped)
instance Prefixed Name where
prefixed (MkName s) = _Wrapped' . prefixed @Text s . from _Wrapped'
getName :: Name -> Text
getName (MkName x) = x
@@ -183,19 +188,10 @@ instance SexpIso Lit where
sexpIso = match
$ With (. sexpIso)
$ With (. sym "nil")
$ With (. bool)
$ With (. Gyehoek.Sexp.schemeBool)
$ With (. sexpIso)
$ With (. Gyehoek.Sexp.prefixSugar "quote" Sexp.Quote sexpIso)
$ End
where
bool :: Sexp.SexpGrammar Bool
bool = Sexp.hashed $ Sexp.partialOsi f g
where
f (S.Symbol ("t";"true")) = Right True
f (S.Symbol ("f";"false")) = Right False
f _ = Left $ Sexp.expected "bool"
g True = S.Symbol "true"
g False = S.Symbol "false"
instance SexpIso Sexp where
sexpIso = match