Make tests work in 7.10 and 8.0

This commit is contained in:
Huw Campbell 2017-02-07 16:11:35 +11:00
parent bad6d0effc
commit 145aba4592
3 changed files with 15 additions and 5 deletions

View File

@ -23,7 +23,6 @@ import Options.Applicative
import Grenade
import Grenade.Recurrent
{-# OPTIONS_GHC -fno-redundant-imports #-}
-- The defininition for our simple recurrent network.
-- This file just trains a network to generate a repeating sequence
-- of 0 0 1.

View File

@ -1,4 +1,5 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
@ -10,6 +11,10 @@ module Test.Grenade.Layers.Nonlinear where
import Data.Singletons
#if __GLASGOW_HASKELL__ < 800
import Data.Proxy
#endif
import Grenade
import GHC.TypeLits

View File

@ -22,7 +22,13 @@ genNat = do
Just n <- someNatVal <$> choose (1, 10)
return n
genShape :: Jack (SomeSing Shape)
#if __GLASGOW_HASKELL__ < 800
type Shape' = ('KProxy :: KProxy Shape)
#else
type Shape' = Shape
#endif
genShape :: Jack (SomeSing Shape')
genShape
= oneOf [
genD1
@ -30,20 +36,20 @@ genShape
, genD3
]
genD1 :: Jack (SomeSing Shape)
genD1 :: Jack (SomeSing Shape')
genD1 = do
n <- genNat
return $ case n of
SomeNat (_ :: Proxy x) -> SomeSing (sing :: Sing ('D1 x))
genD2 :: Jack (SomeSing Shape)
genD2 :: Jack (SomeSing Shape')
genD2 = do
n <- genNat
m <- genNat
return $ case (n, m) of
(SomeNat (_ :: Proxy x), SomeNat (_ :: Proxy y)) -> SomeSing (sing :: Sing ('D2 x y))
genD3 :: Jack (SomeSing Shape)
genD3 :: Jack (SomeSing Shape')
genD3 = do
n <- genNat
m <- genNat