module Language.Haskell.FreeTheorems.Variations.PolySeq.TypeTranslator where import Language.Haskell.FreeTheorems.Variations.PolySeq.Syntax ( Typ(..) , Label(..) , LabVal(..) , TypVar(..) ) import Language.Haskell.FreeTheorems.Syntax ( TypeExpression(..) , Identifier(..) , TypeVariable(..) , TypeConstructor(..) ) translate :: Typ -> TypeExpression translate tau = case tau of TVar (TypVar s) -> TypeVar (TV (Ident s)) TArrow (LVal Epsilon) tau1 tau2 -> TypeFun (translate tau1) (translate tau2) TArrow (LVal Nbr ) tau1 tau2 -> TypeFunLab (translate tau1) (translate tau2) TAll (LVal Epsilon) (TypVar s) tau1 -> TypeAbs (TV (Ident s)) [] (translate tau1) TAll (LVal Nbr ) (TypVar s) tau1 -> TypeAbsLab (TV (Ident s)) [] (translate tau1) TList tau1 -> TypeCon ConList [translate tau1] TInt -> TypeCon ConInt [] TBool -> TypeCon (Con (Ident "Bool")) []