Explorar el Código

feat(utils): change unsafeLog to a -> Effect Unit, old one is now unsafeLog'

Jocelyn Boullier hace 4 años
padre
commit
54ee7fc1e6
Se han modificado 2 ficheros con 10 adiciones y 2 borrados
  1. 7 1
      src/Browser/Utils.js
  2. 3 1
      src/Browser/Utils.purs

+ 7 - 1
src/Browser/Utils.js

@@ -33,8 +33,14 @@ exports.mkListenerThree = function (fn) {
   }
 };
 
-exports.unsafeLog = function (data) {
+exports["unsafeLog'"] = function (data) {
   console.log(">> this is unsafe:");
   console.log(data);
   return data;
 };
+
+exports["unsafeLog"] = function (data) {
+  return function() {
+    exports["unsafeLog'"](data);
+  };
+};

+ 3 - 1
src/Browser/Utils.purs

@@ -11,6 +11,7 @@ module Browser.Utils
   , mkListenerThree
   , unwrapForeign
   , unsafeLog
+  , unsafeLog'
   ) where
 
 import Control.Alt (map)
@@ -58,4 +59,5 @@ unwrapForeign d = case runExcept
   Left err -> throw $ intercalate ", " (map renderForeignError err)
   Right val -> pure val
 
-foreign import unsafeLog :: forall a. a
+foreign import unsafeLog' :: forall a. a
+foreign import unsafeLog :: forall a. a -> Effect Unit