graninas / Hydra

Hydra is a full-fledged framework for building web services, multithreaded and concurrent applications with SQL and KV DB support.
BSD 3-Clause "New" or "Revised" License
189 stars 13 forks source link

Unieveral runSafely method #56

Open graninas opened 4 years ago

graninas commented 4 years ago

Currently, the method has the following signature:

runSafely :: LangL a -> LangL (Either Text a)

But actually it should work for AppL scenarios too.

runSafely :: AppL a -> AppL (Either Text a)

This can be done by introducing separate methods for AppL and LangL: EvalSafelyAppL, EvalSafelyLangL, and adding a type class with runSafely method which will be specified for both languages.


class Safely m where
  runSafely :: m a -> m (Either Text a)

instance Safely LangL where
  runSafely = EvalSafelyLangL

instance Safely AppL where
  runSafely = EvalSafelyAppL