@@ -66,14 +66,15 @@ class any {
6666 StringLiteral = 0x05,
6767 Function = 0x06,
6868 EffFunction = 0x07,
69− Shared = 0x08,
70− String = 0x08,
71− Map = 0x09,
72− Data = 0x0A,
73− Array = 0x0B,
74− Closure = 0x0C,
75− EffClosure = 0x0D,
76− Pointer = 0x0E
69+ RawPointer = 0x08,
70+ Shared = 0x10,
71+ String = 0x10,
72+ Map = 0x11,
73+ Data = 0x12,
74+ Array = 0x13,
75+ Closure = 0x14,
76+ EffClosure = 0x15,
77+ Pointer = 0x16
7778 };
7879
7980 private:
@@ -144,6 +145,7 @@ class any {
144145 mutable cstring r;
145146 mutable fn f;
146147 mutable eff_fn e;
148+ mutable void * u;
147149 mutable shared<std::string> s;
148150 mutable shared<map> m;
149151 mutable shared<data> v;
@@ -215,6 +217,11 @@ class any {
215217 any(T&& val, typename std::enable_if<std::is_assignable<shared<void>,T>::value>::type* = 0) noexcept
216218 : type(Type::Pointer), p(std::move(val)) {}
217219
220+ // Explicit void* to raw pointer value
221+ template <typename T>
222+ any(const T& val, typename std::enable_if<std::is_same<T,void*>::value>::type* = 0) noexcept
223+ : type(Type::RawPointer), u(val) {}
224+
218225 any(std::nullptr_t) noexcept : type(Type::Pointer), p(nullptr) {}
219226
220227
@@ -294,6 +301,12 @@ class any {
294301
295302 auto extractPointer() const -> void*;
296303
304+ auto rawPointer() const -> void* {
305+ const any& variant = unthunkVariant(*this);
306+ assert(type == Type::RawPointer);
307+ return variant.u;
308+ }
309+
297310 static auto unthunkVariant(const any&) -> const any&;
298311
299312 #define DEFINE_OPERATOR(op, ty, rty) \
@@ -390,6 +403,12 @@ inline auto cast(const any& a) ->
390403 return *static_cast<T*>(a.extractPointer());
391404}
392405
406+template <typename T>
407+inline auto cast(const any& a) ->
408+ typename std::enable_if<std::is_same<void*, T>::value, T>::type {
409+ return a.rawPointer();
410+}
411+
393412} // namespace PureScript
394413
395414#undef WITH_ALLOCATOR