fn repr(&self) -> RcType {
        match *self.inner {
            Type::Var(_, ref v) => Type::HostVar(v.clone()).into(),
            Type::Const(ty_const) => Type::Const(ty_const.repr()).into(),
            Type::Lam(span, ref params, ref body_ty) => {
                let repr_params = params
                    .iter()
                    .map(|param| Named::new(param.name.clone(), param.inner.repr()))
                    .collect();

                Type::Lam(span, repr_params, body_ty.repr()).into()
            }
            Type::App(span, ref fn_ty, ref arg_tys) => {
                let arg_tys = arg_tys.iter().map(|arg| arg.repr()).collect();

                Type::App(span, fn_ty.repr(), arg_tys).into()
            }

            Type::Array(_, ref elem_ty, _) => Type::HostArray(elem_ty.repr()).into(),
            Type::Assert(_, ref ty, _) => ty.repr(),
            Type::Interp(_, _, _, ref repr_ty) => repr_ty.clone(),
            Type::Cond(_, ref options) => {
                let repr_variants = options
                    .iter()
                    .map(|variant| Field {
                        doc: Rc::clone(&variant.doc),
                        name: variant.name.clone(),
                        value: variant.value.1.repr(),
                    })
                    .collect();

                Type::HostUnion(repr_variants).into()
            }
            Type::Struct(_, ref fields) => {
                let repr_fields = fields
                    .iter()
                    .map(|field| Field {
                        doc: Rc::clone(&field.doc),
                        name: field.name.clone(),
                        value: field.value.repr(),
                    })
                    .collect();

                Type::HostStruct(repr_fields).into()
            }

            _ => unimplemented!(),
        }
    }
/// Returns the host representation of the binary type
Returns the host representation of the binary type
Returns the host representation of the binary type
fn repr(&self) -> RcType {
        match *self.inner {
            Type::Var(_, ref v) => Type::HostVar(v.clone()).into(),
            Type::Const(ty_const) => Type::Const(ty_const.repr()).into(),
            Type::Lam(span, ref params, ref body_ty) => {
                let repr_params = params
                    .iter()
                    .map(|param| Named::new(param.name.clone(), param.inner.repr()))
                    .collect();
                Type::Lam(span, repr_params, body_ty.repr()).into()
            }
            Type::App(span, ref fn_ty, ref arg_tys) => {
                let arg_tys = arg_tys.iter().map(|arg| arg.repr()).collect();
                Type::App(span, fn_ty.repr(), arg_tys).into()
            }
            Type::Array(_, ref elem_ty, _) => Type::HostArray(elem_ty.repr()).into(),
            Type::Assert(_, ref ty, _) => ty.repr(),
            Type::Interp(_, _, _, ref repr_ty) => repr_ty.clone(),
            Type::Cond(_, ref options) => {
                let repr_variants = options
                    .iter()
                    .map(|variant| Field {
                        doc: Rc::clone(&variant.doc),
                        name: variant.name.clone(),
                        value: variant.value.1.repr(),
                    })
                    .collect();
                Type::HostUnion(repr_variants).into()
            }
            Type::Struct(_, ref fields) => {
                let repr_fields = fields
                    .iter()
                    .map(|field| Field {
                        doc: Rc::clone(&field.doc),
                        name: field.name.clone(),
                        value: field.value.repr(),
                    })
                    .collect();
                Type::HostStruct(repr_fields).into()
            }
            _ => unimplemented!(),
        }
    }
fn repr ( & self ) -> RcType { match * self . inner { Type :: Var ( _ , ref v ) => Type :: HostVar ( v . clone ( ) ) . into ( ) , Type :: Const ( ty_const ) => Type :: Const ( ty_const . repr ( ) ) . into ( ) , Type :: Lam ( span , ref params , ref body_ty ) => { let repr_params = params . iter ( ) . map ( | param | Named :: new ( param . name . clone ( ) , param . inner . repr ( ) ) ) . collect ( ) ; Type :: Lam ( span , repr_params , body_ty . repr ( ) ) . into ( ) } Type :: App ( span , ref fn_ty , ref arg_tys ) => { let arg_tys = arg_tys . iter ( ) . map ( | arg | arg . repr ( ) ) . collect ( ) ; Type :: App ( span , fn_ty . repr ( ) , arg_tys ) . into ( ) } Type :: Array ( _ , ref elem_ty , _ ) => Type :: HostArray ( elem_ty . repr ( ) ) . into ( ) , Type :: Assert ( _ , ref ty , _ ) => ty . repr ( ) , Type :: Interp ( _ , _ , _ , ref repr_ty ) => repr_ty . clone ( ) , Type :: Cond ( _ , ref options ) => { let repr_variants = options . iter ( ) . map ( | variant | Field { doc : Rc :: clone ( & variant . doc ) , name : variant . name . clone ( ) , value : variant . value . 1 . repr ( ) , } ) . collect ( ) ; Type :: HostUnion ( repr_variants ) . into ( ) } Type :: Struct ( _ , ref fields ) => { let repr_fields = fields . iter ( ) . map ( | field | Field { doc : Rc :: clone ( & field . doc ) , name : field . name . clone ( ) , value : field . value . repr ( ) , } ) . collect ( ) ; Type :: HostStruct ( repr_fields ) . into ( ) } _ => unimplemented ! ( ) , } }
Returns the host representation of the binary type
Returns the host representation of the binary type
&self
&self