Skip to content

Commit

Permalink
Generate all from* functions with TH
Browse files Browse the repository at this point in the history
  • Loading branch information
fizruk committed Oct 26, 2024
1 parent c563e7f commit 02ebc95
Show file tree
Hide file tree
Showing 4 changed files with 281 additions and 114 deletions.
8 changes: 4 additions & 4 deletions haskell/free-foil/src/Control/Monad/Free/Foil.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
Expand All @@ -9,6 +8,7 @@
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE UndecidableInstances #-}
Expand Down Expand Up @@ -352,7 +352,7 @@ convertFromAST
-- ^ Peel back one layer of syntax.
-> (rawIdent -> rawTerm)
-- ^ Convert identifier into a raw variable term.
-> (forall x y. (Int -> rawIdent) -> binder x y -> rawPattern)
-> (forall x y. binder x y -> rawPattern)
-- ^ Convert scope-safe pattern into a raw pattern.
-> (rawTerm -> rawScopedTerm)
-- ^ Wrap raw term into a scoped term.
Expand All @@ -376,7 +376,7 @@ convertFromScopedAST
-- ^ Peel back one layer of syntax.
-> (rawIdent -> rawTerm)
-- ^ Convert identifier into a raw variable term.
-> (forall x y. (Int -> rawIdent) -> binder x y -> rawPattern)
-> (forall x y. binder x y -> rawPattern)
-- ^ Convert scope-safe pattern into a raw pattern.
-> (rawTerm -> rawScopedTerm)
-- ^ Wrap raw term into a scoped term.
Expand All @@ -387,5 +387,5 @@ convertFromScopedAST
-> (rawPattern, rawScopedTerm)
convertFromScopedAST fromSig fromVar makePattern makeScoped f = \case
ScopedAST binder body ->
( makePattern f binder
( makePattern binder
, makeScoped (convertFromAST fromSig fromVar makePattern makeScoped f body))
Loading

0 comments on commit 02ebc95

Please sign in to comment.