X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2FHaskellDemo.hs;fp=src%2FHaskellDemo.hs;h=7b545e60146d8f501a1022efa50c2c78d0a30d76;hp=0000000000000000000000000000000000000000;hb=4aadad134578c7f1f450f426c3717bc20adcd8ea;hpb=a83123d8bf8b836e6550a60c321e74a2a8d58598 diff --git a/src/HaskellDemo.hs b/src/HaskellDemo.hs new file mode 100644 index 0000000..7b545e6 --- /dev/null +++ b/src/HaskellDemo.hs @@ -0,0 +1,48 @@ +-- This is written in Haskell. +{-- +JVM-Bridge -- bridge from FP languages and others to the Java VM +Copyright (C) 2001 Ashley Yakeley + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +--} + +module Main where + { + import Header_Java; + import Class_edu_berkeley_sbp_misc_HaskellHelper; + import Class_java_lang_Object; + import Class_java_lang_Class; + import Class_java_lang_String; + + import Class_edu_berkeley_sbp_Tree; + + import JVM_edu_berkeley_sbp_misc_HaskellHelper; + import TypedString; + import JVMBridge; + import JavaText; + + main :: IO (); + main = runWithClasspath ["edu.berkeley.sbp.jar"] + ((do + class_JHaskellHelper + s1 <- new_JString_ArrayJchar $ toJavaString "tests/meta.g" + s2 <- new_JString_ArrayJchar $ toJavaString "tests/testcase.g" + tree <- main_JHaskellHelper_JString_JString (s1, s2) + strx <- toString_JObject ((castTLRef tree) :: Jjava_lang_Object) () + str <- getStringUTF strx + callIO $ putStrLn $ showUTF8 str + return () + ) :: JVM ()) + }