Commit 88cccd4e authored by Björn Peemöller 's avatar Björn Peemöller
Browse files

Formatting stuff

parent f26add68
......@@ -86,18 +86,18 @@ the order of their occurrence. This is handled by the function
> expandAliasType _ (TypeConstrained tys n) = TypeConstrained tys n
> expandAliasType tys (TypeArrow ty1 ty2) =
> TypeArrow (expandAliasType tys ty1) (expandAliasType tys ty2)
> expandAliasType _ (TypeSkolem k) = TypeSkolem k
> expandAliasType _ tsk@(TypeSkolem _) = tsk
> expandAliasType tys (TypeRecord fs rv)
> | isJust rv =
> let (TypeVariable tv) = expandAliasType tys $ TypeVariable $ fromJust rv
> in TypeRecord fs' (Just tv)
> | otherwise =
> TypeRecord fs' Nothing
> where fs' = map (\ (l,ty) -> (l, expandAliasType tys ty)) fs
> where fs' = map (\ (l, ty) -> (l, expandAliasType tys ty)) fs
> normalize :: Type -> Type
> normalize ty = expandAliasType [TypeVariable (occur tv) | tv <- [0..]] ty
> where tvs = zip (nub (filter (>= 0) (typeVars ty))) [0..]
> normalize ty = expandAliasType [TypeVariable (occur tv) | tv <- [0 ..]] ty
> where tvs = zip (nub (filter (>= 0) (typeVars ty))) [0 ..]
> occur tv = fromJust (lookup tv tvs)
\end{verbatim}
......@@ -53,7 +53,6 @@ TODO: The following two imports should be avoided if possible as they make
> operatorDecl = infixDecls modSum
> translationDecl = foldl (qualIDeclId (moduleId modSum)) [] (interface modSum)
> xmlModuleDecl :: ModuleIdent -> Doc
> xmlModuleDecl = xmlModuleIdent
......
......@@ -285,7 +285,7 @@ to the top-level.
> (alts',dss') = unzip $ map liftAlt alts
> liftExpr _ = internalError "Lift.liftExpr"
> liftAlt :: Alt -> (Alt,[Decl])
> liftAlt :: Alt -> (Alt, [Decl])
> liftAlt (Alt p t rhs) = (Alt p t rhs', ds') where (rhs', ds') = liftRhs rhs
\end{verbatim}
......
......@@ -20,7 +20,7 @@ declarations groups as well as function arguments remain unchanged.
> module Transformations.Qual (qual) where
> import Control.Monad (liftM, liftM2, liftM3)
> import qualified Control.Monad.Reader as R
> import qualified Control.Monad.Reader as R (Reader, asks, runReader)
> import Curry.Base.Ident
> import Curry.Syntax
......@@ -81,7 +81,8 @@ declarations groups as well as function arguments remain unchanged.
> liftM2 ArrowType (qualTypeExpr ty1) (qualTypeExpr ty2)
> qualTypeExpr (RecordType fs rty) =
> liftM2 RecordType (mapM qualFieldType fs) (qualRecordType rty)
> where qualFieldType (ls, ty) = do
> where
> qualFieldType (ls, ty) = do
> ty' <- qualTypeExpr ty
> return (ls, ty')
> qualRecordType Nothing = return Nothing
......@@ -107,8 +108,10 @@ declarations groups as well as function arguments remain unchanged.
> qualTerm (InfixPattern t1 op t2) =
> liftM3 InfixPattern (qualTerm t1) (qualIdent op) (qualTerm t2)
> qualTerm (ParenPattern t) = ParenPattern `liftM` qualTerm t
> qualTerm (TuplePattern p ts) = TuplePattern p `liftM` mapM qualTerm ts
> qualTerm (ListPattern p ts) = ListPattern p `liftM` mapM qualTerm ts
> qualTerm (TuplePattern p ts) =
> TuplePattern p `liftM` mapM qualTerm ts
> qualTerm (ListPattern p ts) =
> ListPattern p `liftM` mapM qualTerm ts
> qualTerm (AsPattern v t) = AsPattern v `liftM` qualTerm t
> qualTerm (LazyPattern p t) = LazyPattern p `liftM` qualTerm t
> qualTerm (FunctionPattern f ts) =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment