mirror of
https://github.com/HuwCampbell/grenade.git
synced 2024-11-22 06:55:13 +03:00
Make tests work in 7.10 and 8.0
This commit is contained in:
parent
bad6d0effc
commit
145aba4592
@ -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.
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user