Simple putStrLn in Haskell / Yampa with arrow syntax

I use Haskell with the Yampa FRP library, which uses the arrow language extension.

how can i make simple putStrLn in SF?

mySF = proc x -> do
    y <- identity -< x*x
    putStrLn "Hello World!" ++ show y
    returnA -< y

the arrow syntax complains about the expression, not the arrow (of course), but even with arrows I don't get the output

 output <- identity -< putStrLn "Hello World!"
+3
source share
2 answers

, FRP, , , , IO . "" SF a b reactimate, b -> IO (). - , , putStrLn, .

" " " " , reactimate.

+6

Hello World .

{-# LANGUAGE Arrows #-}

import FRP.Yampa

main = reactimate initialize input output process
initialize  = return "Hello World!"
input _     = return (0.0, Nothing)
output _ x  = putStrLn x >> return True
process     = identity
+5

Source: https://habr.com/ru/post/1747932/


All Articles