pub enum Decl {
Show 16 variants
TypeSig(TypeSig),
FunBind(FunBind),
DataDecl(DataDecl),
TypeAlias(TypeAlias),
Newtype(NewtypeDecl),
ClassDecl(ClassDecl),
InstanceDecl(InstanceDecl),
Foreign(ForeignDecl),
Fixity(FixityDecl),
PragmaDecl(Pragma),
StandaloneDeriving(StandaloneDeriving),
PatternSynonym(PatternSynonymDecl),
TypeFamilyDecl(TypeFamilyDecl),
TypeInstanceDecl(TypeInstanceDecl),
DataFamilyDecl(DataFamilyDecl),
DataInstanceDecl(DataInstanceDecl),
}Expand description
A top-level declaration.
Variants§
TypeSig(TypeSig)
Type signature: foo :: Int -> Int
FunBind(FunBind)
Function/value binding: foo x = x + 1
DataDecl(DataDecl)
Data type: data Foo = A | B Int
TypeAlias(TypeAlias)
Type alias: type Foo = Bar
Newtype(NewtypeDecl)
Newtype: newtype Foo = Foo Bar
ClassDecl(ClassDecl)
Class definition: class Eq a where ...
InstanceDecl(InstanceDecl)
Instance definition: instance Eq Int where ...
Foreign(ForeignDecl)
Foreign import/export
Fixity(FixityDecl)
Fixity declaration: infixl 6 +
PragmaDecl(Pragma)
Pragma declaration: {-# MINIMAL ... #-}
StandaloneDeriving(StandaloneDeriving)
Standalone deriving: deriving instance Show Foo
PatternSynonym(PatternSynonymDecl)
Pattern synonym: pattern Zero = Lit 0
TypeFamilyDecl(TypeFamilyDecl)
Standalone type family: type family F a or type family F a where ...
TypeInstanceDecl(TypeInstanceDecl)
Standalone type family instance: type instance F Int = Bool
DataFamilyDecl(DataFamilyDecl)
Standalone data family: data family F a
DataInstanceDecl(DataInstanceDecl)
Data family instance: data instance F Int = Con1 Int | Con2
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Decl
impl RefUnwindSafe for Decl
impl Send for Decl
impl Sync for Decl
impl Unpin for Decl
impl UnsafeUnpin for Decl
impl UnwindSafe for Decl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more