Rlang-QQ-0.1.0.0: examples/test2.hs
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE QuasiQuotes #-}
module Main where
import RlangQQ
import Data.HList
x = [0 .. 10 :: Double]
y = map (sin . (*pi) . (/10)) x
test = [r| print('hi'); hs_z <- hs_x + hs_y |]
test2 = fmap (.!. (Label :: Label "z")) test
test3 = print =<< (test2 :: IO [Double])
main = do
test3
let hs = zipWith (+) x y
let sse x y = sum $ zipWith (\a b -> (a-b)^2) x y
fmap (sse hs) test2