VoQnさんので言うと, https://github.com/VoQn/cacco/blob/master/src/Cacco/Ann.hs#L21 がまさにCofreeですね.(Indexed Fixはまだ導入してなさそう?)
UndecidableInstances は避けてる人なので,ちょっと余計なインスタンス宣言が増えますが, deriving (Show (f (Fix f)) => ... の部分は deriving (Show1 f) => ... で書く派なので,そこの部分も気になりましたUndecidableInstances が入ってる印象があるので,もし拡張のプラグマをコピペしてる感じだったらむしろ,cabalのdefault-extensionsを使って,モジュール別に必要な拡張だけモジュールごとに指定するのがいいかもしれません(GADTs と ScopedTypeVariables 拡張を加えて,
astFix :: forall t (i :: AstIx). IxFunctor t => AstIxProxy i -> AstIxFixParser t i
astFix proxy d e p t = case proxy of
DeclProxy -> d'
ExprProxy -> e'
PattProxy -> p'
TypeProxy -> t'
where
astFix' :: (forall f. AstIxParser t f j) -> Parser (IxFix t j)
astFix' f = In <$> f d' e' p' t'
d' = astFix' d
e' = astFix' e
p' = astFix' p
t' = astFix' t
{-# INLINEABLE astFix #-}
located :: forall f (i :: AstIx). AstIxParser AstF f i -> AstIxParser (IxAnnF Location AstF) f i
located f d e p t = IxAnnF <$> withLocation (f d e p t)
{-# INLINE located #-}
astParser :: AstIxProxy i -> Parser (IxAnn Location AstF i)
astParser proxy = astFix proxy
(located declAstF) (located exprAstF) (located pattAstF) (located typeAstF)
declAst :: Parser (IxAnn Location AstF AstDecl)
declAst = astParser DeclProxy
{-# INLINEABLE declAst #-}
exprAst :: Parser (IxAnn Location AstF AstExpr)
exprAst = astParser ExprProxy
{-# INLINEABLE exprAst #-}
pattAst :: Parser (IxAnn Location AstF AstPatt)
pattAst = astParser PattProxy
{-# INLINEABLE pattAst #-}
typeAst :: Parser (IxAnn Location AstF AstType)
typeAst = astParser TypeProxy
{-# INLINEABLE typeAst #-}
IndexedCofree f a i っていう型を作って出来るか試してみたら出来ましたLogExtractor(ログファイルの有無を確認し、ある場合には読み込む)に関してOSごとにFilePathを指定する部分が若干不安です(とくにユーザー名に半角英数字以外を使用しているユーザーに対して動作するのか)