#ifndef GOOSE_BUILTINS_TYPES_BASIC_H
#define GOOSE_BUILTINS_TYPES_BASIC_H
namespace goose::builtins
{
extern void SetupBasicTypes( Env& e );
struct ValuePatternT
{
static const Term& GetPattern();
};
template< typename T >
struct PatternValueTypeOf
{
static const Term& GetPattern()
{
static auto pat = GetValueType< T >();
return pat;
}
};
template< typename T >
using ValueTypeOf = CustomPattern< Value, PatternValueTypeOf< T > >;
}
namespace goose::ir
{
template<>
struct Bridge< void >
{
static const Term& Type();
};
template<>
struct Bridge< bool >
{
static const Term& Type();
static Value ToValue( bool x );
static optional< bool > FromValue( const Value& v );
};
template<>
struct Bridge< BigInt >
{
static const Term& Type();
template< typename T >
static Value ToValue( T&& x )
{
return Value( Type(), TERM( BigInt( forward< T >( x ) ) ) );
}
static const BigInt* FromValue( const Value& v );
};
template<>
struct Bridge< char32_t >
{
static const Term& Type();
static Value ToValue( char32_t x );
static optional< char32_t> FromValue( const Value& v );
};
template<>
struct Bridge< string >
{
static const Term& Type();
static Value ToValue( const string& x );
static const string* FromValue( const Value& v );
};
template<>
struct Bridge< Value >
{
static const Term& Type();
static const Value& ToValue( const Value& v ) { return v; }
static const Value* FromValue( const Value& v ) { return &v; }
};
}
#endif