Created
November 12, 2021 14:33
-
-
Save mpickering/457065b6ff777f09d862b2e1378d68ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "header.h" | |
int q() { | |
int e = foo(0); | |
return(0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <HsFFI.h> | |
int foo(int); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TemplateHaskell #-} | |
module Main where | |
import P | |
main = $([| return () |]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module P where | |
foreign export ccall foo :: Int -> IO Int | |
foo :: Int -> IO Int | |
foo n = return (length (f n)) | |
f :: Int -> [Int] | |
f 0 = [] | |
f n = n:(f (n-1)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment