{-  Copyright 2010 Dominique Devriese

    This file is part of the grammar-combinators library.

    The grammar-combinators library is free software: you can
    redistribute it and/or modify it under the terms of the GNU
    Lesser General Public License as published by the Free
    Software Foundation, either version 3 of the License, or (at
    your option) any later version.

    Foobar is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General
    Public License along with Foobar. If not, see
    <http://www.gnu.org/licenses/>.
-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}

module Text.GrammarCombinators.TH.FoldLoops where

import Text.GrammarCombinators.Base
import Text.GrammarCombinators.Transform.FoldLoops

import Language.Haskell.TH.Syntax

instance (Lift (Memo phi (SubVal FLBaseIx v)),
          Lift (Memo phi (SubVal FLManyIx v))) =>
         Lift (Memo (FoldLoopsDomain phi) v) where
  lift (FLM mb mm) = [| FLM $(lift mb) $(lift mm) |]