@@ -30,13 +30,13 @@ module Foreign
3030import Prelude
3131
3232import Control.Monad.Except (Except , throwError , mapExcept )
33-
3433import Data.Either (Either (..), either )
3534import Data.Int as Int
3635import Data.List.NonEmpty (NonEmptyList )
3736import Data.List.NonEmpty as NEL
3837import Data.Maybe (Maybe (..), maybe )
3938import Data.String.CodeUnits (toChar )
39+ import Unsafe.Coerce (unsafeCoerce )
4040
4141-- | A type for _foreign data_.
4242-- |
@@ -88,10 +88,12 @@ type F = Except MultipleErrors
8888-- | JavaScript types, rather than PureScript types. Exporting PureScript values
8989-- | via the FFI can be dangerous as they can be mutated by code outside the
9090-- | PureScript program, resulting in difficult to diagnose problems elsewhere.
91- foreign import unsafeToForeign :: forall a . a -> Foreign
91+ unsafeToForeign :: forall a . a -> Foreign
92+ unsafeToForeign = unsafeCoerce
9293
9394-- | Unsafely coerce a `Foreign` value.
94- foreign import unsafeFromForeign :: forall a . Foreign -> a
95+ unsafeFromForeign :: forall a . Foreign -> a
96+ unsafeFromForeign = unsafeCoerce
9597
9698-- | Read the Javascript _type_ of a value
9799foreign import typeOf :: Foreign -> String
0 commit comments