Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit ccf8e1a

Browse files
committed
Add a little lambda calculus to toy with.
1 parent 610acb7 commit ccf8e1a

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/Serializing/SExpression/Precise.hs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
{-# LANGUAGE DataKinds, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings, ScopedTypeVariables, TypeApplications, TypeFamilies, TypeOperators, UndecidableInstances #-}
1+
{-# LANGUAGE DataKinds, DeriveGeneric, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings, ScopedTypeVariables, TypeApplications, TypeFamilies, TypeOperators, UndecidableInstances #-}
22
module Serializing.SExpression.Precise
33
( serializeSExpression
4+
, Expr(..)
5+
, Identifier(..)
46
) where
57

68
import Data.ByteString.Builder
@@ -31,8 +33,9 @@ instance (ToSExpressionWithStrategy strategy t, strategy ~ ToSExpressionStrategy
3133
data Strategy = Generic | Show
3234

3335
type family ToSExpressionStrategy t :: Strategy where
34-
ToSExpressionStrategy Text = 'Show
35-
ToSExpressionStrategy _ = 'Generic
36+
ToSExpressionStrategy Text = 'Show
37+
ToSExpressionStrategy Integer = 'Show
38+
ToSExpressionStrategy _ = 'Generic
3639

3740
class ToSExpressionWithStrategy (strategy :: Strategy) t where
3841
toSExpressionWithStrategy :: proxy strategy -> t -> Int -> Builder
@@ -68,3 +71,10 @@ instance GToSExpression f => GToSExpression (M1 S s f) where
6871

6972
instance ToSExpression k => GToSExpression (K1 R k) where
7073
gtoSExpression k = pure . toSExpression (unK1 k)
74+
75+
76+
data Expr = Var Identifier | Lam Identifier Expr | App Expr Expr | Int Integer
77+
deriving (Generic)
78+
79+
newtype Identifier = Identifier Text
80+
deriving (Generic)

0 commit comments

Comments
 (0)