Skip to content

Commit b6841eb

Browse files
authored
issue-59 upgrade to Idris 1.1.1 (#60)
1 parent 6cfa9e9 commit b6841eb

File tree

6 files changed

+32
-3
lines changed

6 files changed

+32
-3
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ jdk:
1313
- oraclejdk8
1414

1515
before_install:
16-
- docker pull mmhelloworld/idris:1.0
16+
- docker pull mmhelloworld/idris:1.1.1
1717
- mkdir -p $HOME/bin/idris-packages $HOME/bin/idris-jvm
1818
- wget https://github.com/mmhelloworld/idris-jvm/releases/download/1.0-SNAPSHOT-20170704/idris-jvm-1.0-SNAPSHOT-20170704.zip
1919
- unzip -o idris-jvm-*.zip -d $HOME/bin
2020
- export PATH=`pwd`/bin/travis:$HOME/bin/idris-jvm/codegen/bin:$HOME/.local/bin:$PATH
2121
- export PROJECT_ROOT=`pwd`
22-
- docker run --name idris mmhelloworld/idris:1.0 idris -v && docker cp idris:/root/.stack/snapshots/x86_64-linux/lts-8.18/8.0.2/share/x86_64-linux-ghc-8.0.2/idris-1.0/libs/. $HOME/bin/idris-packages && docker rm idris
22+
- docker run --name idris mmhelloworld/idris:1.1.1 idris -v && docker cp idris:/.stack-work/install/x86_64-linux/lts-9.1/8.0.2/share/x86_64-linux-ghc-8.0.2/idris-1.1.1/libs/. $HOME/bin/idris-packages && docker rm idris
2323

2424
script:
2525
- mvn -pl :idris-jvm-integration-test test -B

bin/travis/idris

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env bash
22

3-
travis_long docker run -v $HOME/bin/idris-packages:/root/.stack/snapshots/x86_64-linux/lts-8.18/8.0.2/share/x86_64-linux-ghc-8.0.2/idris-1.0/libs -v $PROJECT_ROOT:$PROJECT_ROOT -v $JAVA_HOME:/bin/jdk -v $HOME/bin/idris-jvm:/bin/idris-jvm -w `pwd` mmhelloworld/idris:1.0 idris "$@"
3+
travis_long docker run -v $HOME/bin/idris-packages:/.stack-work/install/x86_64-linux/lts-9.1/8.0.2/share/x86_64-linux-ghc-8.0.2/idris-1.1.1/libs -v $PROJECT_ROOT:$PROJECT_ROOT -v $JAVA_HOME:/bin/jdk -v $HOME/bin/idris-jvm:/bin/idris-jvm -w `pwd` mmhelloworld/idris:1.1.1 idris "$@"
44

idris-jvm-core/src/main/idris/IdrisJvm/Core/Operator.idr

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,12 @@ cgOp2 (LSExt (ITFixed from) ITBig) [x] = signExtendToBigInteger x
271271

272272
cgOp2 (LSExt _ _) [x] = Aload $ locIndex x
273273

274+
cgOp2 (LTrunc ITNative (ITFixed IT64)) [x] = do
275+
Aload $ locIndex x
276+
Checkcast "java/lang/Integer"
277+
InvokeMethod InvokeVirtual "java/lang/Integer" "longValue" "()J" False
278+
boxLong
279+
274280
cgOp2 (LTrunc (ITFixed IT64) (ITFixed IT32)) [x] = do
275281
Aload $ locIndex x
276282
Checkcast "java/lang/Long"

idris-jvm-ffi/src/main/idris/IdrisJvm/Effects.idr

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Effect.System
55
import Effect.StdIO
66
import IdrisJvm.IO
77
import IdrisJvm.System
8+
import Java.Util.Concurrent
89

910
%access export
1011

@@ -19,3 +20,6 @@ implementation Handler System JVM_IO where
1920
handle () Time k = do x <- time; k x ()
2021
handle () (GetEnv s) k = do x <- getEnv s; k x ()
2122
handle () (CSystem s) k = do x <- system s; k x ()
23+
handle () (Usleep timeout _) k = do
24+
sleep microseconds $ prim__truncInt_B64 timeout
25+
k () ()
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module Java.Util.Concurrent
2+
3+
import IdrisJvm.FFI
4+
5+
%access public export
6+
7+
namespace TimeUnit
8+
TimeUnitClass : JVM_NativeTy
9+
TimeUnitClass = Class "java/util/concurrent/TimeUnit"
10+
11+
TimeUnit : Type
12+
TimeUnit = JVM_Native TimeUnitClass
13+
14+
microseconds : TimeUnit
15+
microseconds = unsafePerformIO $ getStaticField TimeUnitClass "MICROSECONDS" (JVM_IO TimeUnit)
16+
17+
sleep : TimeUnit -> Bits64 -> JVM_IO ()
18+
sleep timeunit timeout = invokeInstance "sleep" (TimeUnit -> Bits64 -> JVM_IO ()) timeunit timeout

idris-jvm-ffi/src/main/idris/idris-jvm-ffi.ipkg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pkgs = effects
55
modules = IdrisJvm.FFI
66
, IdrisJvm.IO
77
, IdrisJvm.System
8+
, Java.Util.Concurrent
89
, IdrisJvm.Effects
910
, Java.Lang
1011
, Java.Util

0 commit comments

Comments
 (0)