curry-base-1.0.0: Functions for manipulating Curry programs

Copyright(c) 1999 - 2004 Wolfgang Lux
2005 Martin Engelke
2011 - 2015 Björn Peemöller
2014 Jan Rasmus Tikovsky
2016 Finn Teegen
LicenseBSD-3-clause
Maintainerbjp@informatik.uni-kiel.de
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Curry.Syntax.Type

Contents

Description

This module provides the necessary data structures to maintain the parsed representation of a Curry program.

Synopsis

Module header

data Module a Source #

Curry module

Instances

Functor Module Source # 

Methods

fmap :: (a -> b) -> Module a -> Module b #

(<$) :: a -> Module b -> Module a #

Eq a => Eq (Module a) Source # 

Methods

(==) :: Module a -> Module a -> Bool #

(/=) :: Module a -> Module a -> Bool #

Read a => Read (Module a) Source # 
Show a => Show (Module a) Source # 

Methods

showsPrec :: Int -> Module a -> ShowS #

show :: Module a -> String #

showList :: [Module a] -> ShowS #

Module pragmas

data Tool Source #

Different Curry tools which may accept compiler options.

Export specification

Import declarations

type Qualified = Bool Source #

Flag to signal qualified import

Interface

data Interface Source #

Module interface

Interface declarations are restricted to type declarations and signatures. Note that an interface function declaration additionaly contains the function arity (= number of parameters) in order to generate correct FlatCurry function applications.

type Arity = Int Source #

Arity of a function

type IMethodImpl = (Ident, Arity) Source #

Class method implementations

Declarations

type Precedence = Integer Source #

Operator precedence

data Infix Source #

Fixity of operators

Constructors

InfixL

left-associative

InfixR

right-associative

Infix

no associativity

data Equation a Source #

Function defining equation

Constructors

Equation Position (Lhs a) (Rhs a) 

Instances

Functor Equation Source # 

Methods

fmap :: (a -> b) -> Equation a -> Equation b #

(<$) :: a -> Equation b -> Equation a #

Eq a => Eq (Equation a) Source # 

Methods

(==) :: Equation a -> Equation a -> Bool #

(/=) :: Equation a -> Equation a -> Bool #

Read a => Read (Equation a) Source # 
Show a => Show (Equation a) Source # 

Methods

showsPrec :: Int -> Equation a -> ShowS #

show :: Equation a -> String #

showList :: [Equation a] -> ShowS #

data Lhs a Source #

Left-hand-side of an Equation (function identifier and patterns)

Constructors

FunLhs Ident [Pattern a] 
OpLhs (Pattern a) Ident (Pattern a) 
ApLhs (Lhs a) [Pattern a] 

Instances

Functor Lhs Source # 

Methods

fmap :: (a -> b) -> Lhs a -> Lhs b #

(<$) :: a -> Lhs b -> Lhs a #

Eq a => Eq (Lhs a) Source # 

Methods

(==) :: Lhs a -> Lhs a -> Bool #

(/=) :: Lhs a -> Lhs a -> Bool #

Read a => Read (Lhs a) Source # 
Show a => Show (Lhs a) Source # 

Methods

showsPrec :: Int -> Lhs a -> ShowS #

show :: Lhs a -> String #

showList :: [Lhs a] -> ShowS #

data Rhs a Source #

Right-hand-side of an Equation

Constructors

SimpleRhs Position (Expression a) [Decl a] 
GuardedRhs [CondExpr a] [Decl a] 

Instances

Functor Rhs Source # 

Methods

fmap :: (a -> b) -> Rhs a -> Rhs b #

(<$) :: a -> Rhs b -> Rhs a #

Eq a => Eq (Rhs a) Source # 

Methods

(==) :: Rhs a -> Rhs a -> Bool #

(/=) :: Rhs a -> Rhs a -> Bool #

Read a => Read (Rhs a) Source # 
Show a => Show (Rhs a) Source # 

Methods

showsPrec :: Int -> Rhs a -> ShowS #

show :: Rhs a -> String #

showList :: [Rhs a] -> ShowS #

data CondExpr a Source #

Conditional expression (expression conditioned by a guard)

Constructors

CondExpr Position (Expression a) (Expression a) 

Instances

Functor CondExpr Source # 

Methods

fmap :: (a -> b) -> CondExpr a -> CondExpr b #

(<$) :: a -> CondExpr b -> CondExpr a #

Eq a => Eq (CondExpr a) Source # 

Methods

(==) :: CondExpr a -> CondExpr a -> Bool #

(/=) :: CondExpr a -> CondExpr a -> Bool #

Read a => Read (CondExpr a) Source # 
Show a => Show (CondExpr a) Source # 

Methods

showsPrec :: Int -> CondExpr a -> ShowS #

show :: CondExpr a -> String #

showList :: [CondExpr a] -> ShowS #

data Expression a Source #

Expression

data InfixOp a Source #

Infix operation

Instances

Functor InfixOp Source # 

Methods

fmap :: (a -> b) -> InfixOp a -> InfixOp b #

(<$) :: a -> InfixOp b -> InfixOp a #

Eq a => Eq (InfixOp a) Source # 

Methods

(==) :: InfixOp a -> InfixOp a -> Bool #

(/=) :: InfixOp a -> InfixOp a -> Bool #

Read a => Read (InfixOp a) Source # 
Show a => Show (InfixOp a) Source # 

Methods

showsPrec :: Int -> InfixOp a -> ShowS #

show :: InfixOp a -> String #

showList :: [InfixOp a] -> ShowS #

data Statement a Source #

Statement (used for do-sequence and list comprehensions)

Constructors

StmtExpr (Expression a) 
StmtDecl [Decl a] 
StmtBind (Pattern a) (Expression a) 

Instances

data Alt a Source #

Single case alternative

Constructors

Alt Position (Pattern a) (Rhs a) 

Instances

Functor Alt Source # 

Methods

fmap :: (a -> b) -> Alt a -> Alt b #

(<$) :: a -> Alt b -> Alt a #

Eq a => Eq (Alt a) Source # 

Methods

(==) :: Alt a -> Alt a -> Bool #

(/=) :: Alt a -> Alt a -> Bool #

Read a => Read (Alt a) Source # 
Show a => Show (Alt a) Source # 

Methods

showsPrec :: Int -> Alt a -> ShowS #

show :: Alt a -> String #

showList :: [Alt a] -> ShowS #

data Field a Source #

Record field

Constructors

Field Position QualIdent a 

Instances

Functor Field Source # 

Methods

fmap :: (a -> b) -> Field a -> Field b #

(<$) :: a -> Field b -> Field a #

Eq a => Eq (Field a) Source # 

Methods

(==) :: Field a -> Field a -> Bool #

(/=) :: Field a -> Field a -> Bool #

Read a => Read (Field a) Source # 
Show a => Show (Field a) Source # 

Methods

showsPrec :: Int -> Field a -> ShowS #

show :: Field a -> String #

showList :: [Field a] -> ShowS #

data Var a Source #

Annotated identifier

Constructors

Var a Ident 

Instances

Functor Var Source # 

Methods

fmap :: (a -> b) -> Var a -> Var b #

(<$) :: a -> Var b -> Var a #

Eq a => Eq (Var a) Source # 

Methods

(==) :: Var a -> Var a -> Bool #

(/=) :: Var a -> Var a -> Bool #

Read a => Read (Var a) Source # 
Show a => Show (Var a) Source # 

Methods

showsPrec :: Int -> Var a -> ShowS #

show :: Var a -> String #

showList :: [Var a] -> ShowS #

Type classes

Goals

data Goal a Source #

Goal in REPL (expression to evaluate)

Constructors

Goal Position (Expression a) [Decl a] 

Instances

Functor Goal Source # 

Methods

fmap :: (a -> b) -> Goal a -> Goal b #

(<$) :: a -> Goal b -> Goal a #

Eq a => Eq (Goal a) Source # 

Methods

(==) :: Goal a -> Goal a -> Bool #

(/=) :: Goal a -> Goal a -> Bool #

Read a => Read (Goal a) Source # 
Show a => Show (Goal a) Source # 

Methods

showsPrec :: Int -> Goal a -> ShowS #

show :: Goal a -> String #

showList :: [Goal a] -> ShowS #