2022-07-01 00:01:31 +03:00
|
|
|
import Language.Reflection
|
|
|
|
|
|
|
|
%default total
|
|
|
|
|
|
|
|
%language ElabReflection
|
|
|
|
|
|
|
|
x : List String
|
|
|
|
x = ["a", "b"]
|
|
|
|
|
2024-04-03 17:41:57 +03:00
|
|
|
private infixl 1 >==>
|
2022-07-01 00:01:31 +03:00
|
|
|
|
|
|
|
-- From prelude:
|
|
|
|
--(>=>) : Monad m => (a -> m b) -> (b -> m c) -> (a -> m c)
|
|
|
|
--(>=>) f g = \x => f x >>= g
|
|
|
|
|
|
|
|
(>==>) : Monad m => (a -> m b) -> (b -> m c) -> (a -> m c)
|
|
|
|
(>==>) f g = \x => f x >>= \r => g r
|
|
|
|
|
|
|
|
%runElab traverse_ (pure >==> logMsg "debug" 0) x
|
|
|
|
%runElab traverse_ (pure >=> \s => logMsg "debug" 0 s) x
|
|
|
|
%runElab traverse_ (pure >=> logMsg "debug" 0) x
|
|
|
|
|
|
|
|
testing0 : Bool -> Elab String
|
|
|
|
testing0 False = pure "This is false"
|
|
|
|
testing0 True = pure "this is true"
|
|
|
|
|
|
|
|
testing1 : String -> Elab ()
|
|
|
|
testing1 x = logMsg x 0 "debug"
|
|
|
|
|
|
|
|
%runElab traverse_ (testing0 >=> testing1) [False, True]
|