on master help sign in
Make tests work in 7.10 and 8.0
145aba4Huw Campbell
main/recurrent.hs−1
@@ -23,7 +23,6 @@ import Options.Applicative
23import Grenade
23import Grenade
24import Grenade.Recurrent
24import Grenade.Recurrent
25
25
26−{-# OPTIONS_GHC -fno-redundant-imports #-}
27-- The defininition for our simple recurrent network.
26-- The defininition for our simple recurrent network.
28-- This file just trains a network to generate a repeating sequence
27-- This file just trains a network to generate a repeating sequence
29-- of 0 0 1.
28-- of 0 0 1.
test/Test/Grenade/Layers/Nonlinear.hs+5
@@ -1,4 +1,5 @@
1{-# LANGUAGE BangPatterns #-}
1{-# LANGUAGE BangPatterns #-}
2+{-# LANGUAGE CPP #-}
2{-# LANGUAGE TemplateHaskell #-}
3{-# LANGUAGE TemplateHaskell #-}
3{-# LANGUAGE DataKinds #-}
4{-# LANGUAGE DataKinds #-}
4{-# LANGUAGE KindSignatures #-}
5{-# LANGUAGE KindSignatures #-}
@@ -10,6 +11,10 @@ module Test.Grenade.Layers.Nonlinear where
10
11
11import Data.Singletons
12import Data.Singletons
12
13
14+#if __GLASGOW_HASKELL__ < 800
15+import Data.Proxy
16+#endif
17+
13import Grenade
18import Grenade
14import GHC.TypeLits
19import GHC.TypeLits
15
20
test/Test/Jack/TypeLits.hs+10−4
@@ -22,7 +22,13 @@ genNat = do
22 Just n <- someNatVal <$> choose (1, 10)
22 Just n <- someNatVal <$> choose (1, 10)
23 return n
23 return n
24
24
25+#if __GLASGOW_HASKELL__ < 800
26+type Shape' = ('KProxy :: KProxy Shape)
27+#else
28+type Shape' = Shape
29+#endif
30+
25−genShape :: Jack (SomeSing Shape)
31+genShape :: Jack (SomeSing Shape')
26genShape
32genShape
27 = oneOf [
33 = oneOf [
28 genD1
34 genD1
@@ -30,20 +36,20 @@ genShape
30 , genD3
36 , genD3
31 ]
37 ]
32
38
33−genD1 :: Jack (SomeSing Shape)
39+genD1 :: Jack (SomeSing Shape')
34genD1 = do
40genD1 = do
35 n <- genNat
41 n <- genNat
36 return $ case n of
42 return $ case n of
37 SomeNat (_ :: Proxy x) -> SomeSing (sing :: Sing ('D1 x))
43 SomeNat (_ :: Proxy x) -> SomeSing (sing :: Sing ('D1 x))
38
44
39−genD2 :: Jack (SomeSing Shape)
45+genD2 :: Jack (SomeSing Shape')
40genD2 = do
46genD2 = do
41 n <- genNat
47 n <- genNat
42 m <- genNat
48 m <- genNat
43 return $ case (n, m) of
49 return $ case (n, m) of
44 (SomeNat (_ :: Proxy x), SomeNat (_ :: Proxy y)) -> SomeSing (sing :: Sing ('D2 x y))
50 (SomeNat (_ :: Proxy x), SomeNat (_ :: Proxy y)) -> SomeSing (sing :: Sing ('D2 x y))
45
51
46−genD3 :: Jack (SomeSing Shape)
52+genD3 :: Jack (SomeSing Shape')
47genD3 = do
53genD3 = do
48 n <- genNat
54 n <- genNat
49 m <- genNat
55 m <- genNat