summaryrefslogtreecommitdiff
path: root/testsuite/tests/ffi/should_run/ffi001.hs
blob: 42f2b3f88327ef0d8e7c35337d292577eebd8fd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19


-- !!! A simple FFI test

-- This one provoked a bogus renamer error in 4.08.1:
--      panic: tcLookupGlobalValue: <THIS>.PrelIOBase.returnIO{-0B,s-}
-- (the error was actually in DsMonad.dsLookupGlobalValue!)

module Main where

import Foreign

foreign export ccall "gccd" mygcd :: Int -> Int -> Int

main = putStrLn "No bug"

mygcd a b = if (a==b) then a
            else if (a<b) then mygcd a (b-a)
            else mygcd (a-b) a