graninas/Hydra

Unieveral runSafely method

Aperta

#56 aperta il 13 giu 2020

 (0 commenti) (0 reazioni) (0 assegnatari)Haskell (14 fork)github user discovery
enhancementgood first issue

Metriche repository

Star
 (206 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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

Guida contributor