packages feed

DeepDarkFantasy 0.2017.8.7 → 0.2017.8.8

raw patch · 11 files changed

+52/−66 lines, 11 filesdep −constraint-unions

Dependencies removed: constraint-unions

Files

DDF/Eval.hs view
@@ -165,3 +165,5 @@   double2Float = comb M.double2Float   state = comb M.state   runState = comb M.runState++newtype Eval h x = Eval {runEval :: h -> x}
DDF/ImpW.hs view
@@ -7,18 +7,61 @@   TypeFamilies,   TypeApplications,   FlexibleInstances,-  MultiParamTypeClasses+  MultiParamTypeClasses,+  TypeOperators #-}  module DDF.ImpW where  import DDF.Lang+import DDF.WithDiff import qualified DDF.Map as Map import qualified DDF.VectorTF as VTF+import qualified Prelude as M +class ProdCon con l r where+  prodCon :: (con l, con r) :- con (l, r)++instance ProdCon Random l r where prodCon = Sub Dict++instance ProdCon RandRange l r where prodCon = Sub Dict++instance ProdCon M.Show l r where prodCon = Sub Dict++instance Lang repr => ProdCon (Monoid repr) l r where prodCon = Sub Dict++instance Lang repr => ProdCon (Reify repr) l r where prodCon = Sub Dict++instance Lang repr => ProdCon (Vector repr) l r where prodCon = Sub Dict++instance Lang repr => ProdCon (WithDiff repr) l r where prodCon = Sub Dict++class Weight w where+  weightCon :: (con (), con M.Float, con M.Double, ForallV (ProdCon con)) :- con w++instance Weight () where weightCon = Sub Dict++instance Weight M.Double where weightCon = Sub Dict++instance Weight M.Float where weightCon = Sub Dict++instance (Weight l, Weight r) => Weight (l, r) where+  weightCon :: forall con. (con (), con M.Float, con M.Double, ForallV (ProdCon con)) :- con (l, r)+  weightCon = Sub (mapDict (prodCon \\ (instV :: (ForallV (ProdCon con) :- ProdCon con l r))) (Dict \\ weightCon @l @con \\ weightCon @r @con))+ runImpW :: forall r h x. Unit r => ImpW r h x -> RunImpW r h x runImpW (ImpW x) = RunImpW x runImpW (NoImpW x) = RunImpW (const1 x :: r h (() -> x))++data RunImpW repr h x = forall w. Weight w => RunImpW (repr h (w -> x))+data ImpW repr h x = NoImpW (repr h x) | forall w. Weight w => ImpW (repr h (w -> x))+type RunImpWR repr h x = forall r. (forall w. Weight w => repr h (w -> x) -> r) -> r++runImpW2RunImpWR :: RunImpW repr h x -> RunImpWR repr h x+runImpW2RunImpWR (RunImpW x) = \f -> f x++runImpWR2RunImpW :: RunImpWR repr h x -> RunImpW repr h x+runImpWR2RunImpW f = f RunImpW  instance Prod r => DBI (ImpW r) where   z = NoImpW z
DDF/Lang.hs view
@@ -102,12 +102,6 @@ instance (Lang repr, Reify repr l, Reify repr r) => Reify repr (l, r) where   reify (l, r) = mkProd2 (reify l) (reify r) -instance Lang repr => ProdCon (Monoid repr) l r where prodCon = Sub Dict--instance Lang repr => ProdCon (Reify repr) l r where prodCon = Sub Dict--instance Lang repr => ProdCon (Vector repr) l r where prodCon = Sub Dict- instance Lang r => Monoid r () where   zero = unit   plus = const1 $ const1 unit
DDF/Meta/Diff.hs view
@@ -12,10 +12,9 @@   FlexibleContexts #-} -module DDF.Meta.Diff (module DDF.Meta.Diff, module DDF.Meta.Interpreter, module DDF.Vector) where+module DDF.Meta.Diff (module DDF.Meta.Diff, module DDF.Vector) where  import DDF.Vector-import DDF.Meta.Interpreter  type family DiffType (v :: *) (x :: *) 
− DDF/Meta/Interpreter.hs
@@ -1,50 +0,0 @@-{-# LANGUAGE-  RankNTypes,-  TypeApplications,-  TypeOperators,-  ScopedTypeVariables,-  MultiParamTypeClasses,-  ExistentialQuantification,-  FlexibleInstances,-  InstanceSigs-#-}--module DDF.Meta.Interpreter (module DDF.Meta.Interpreter, module DDF.ImportMeta) where--import DDF.ImportMeta--newtype Eval h x = Eval {runEval :: h -> x}--newtype UnHOAS repr h x = UnHOAS {runUnHOAS :: repr h x}--class ProdCon con l r where-  prodCon :: (con l, con r) :- con (l, r)--instance ProdCon Random l r where prodCon = Sub Dict--instance ProdCon RandRange l r where prodCon = Sub Dict--instance ProdCon Show l r where prodCon = Sub Dict--class Weight w where-  weightCon :: (con (), con Float, con Double, ForallV (ProdCon con)) :- con w--instance Weight () where weightCon = Sub Dict--instance Weight Double where weightCon = Sub Dict--instance Weight Float where weightCon = Sub Dict--instance (Weight l, Weight r) => Weight (l, r) where-  weightCon :: forall con. (con (), con Float, con Double, ForallV (ProdCon con)) :- con (l, r)-  weightCon = Sub (mapDict (prodCon \\ (instV :: (ForallV (ProdCon con) :- ProdCon con l r))) (Dict \\ weightCon @l @con \\ weightCon @r @con))--data RunImpW repr h x = forall w. Weight w => RunImpW (repr h (w -> x))-data ImpW repr h x = NoImpW (repr h x) | forall w. Weight w => ImpW (repr h (w -> x))-type RunImpWR repr h x = forall r. (forall w. Weight w => repr h (w -> x) -> r) -> r--runImpW2RunImpWR :: RunImpW repr h x -> RunImpWR repr h x-runImpW2RunImpWR (RunImpW x) = \f -> f x--runImpWR2RunImpW :: RunImpWR repr h x -> RunImpW repr h x-runImpWR2RunImpW f = f RunImpW
DDF/Poly.lhs view
@@ -25,7 +25,7 @@ > import Prelude (Integer)
 > import qualified Prelude as M
 > import qualified DDF.Meta.Dual as M
-> import DDF.Eval ()
+> import DDF.Eval
 
 Importing files and opening language extension...
 So, our goal is to find x, where x * x + 2 * x + 3 = 27.
DDF/UnHOAS.hs view
@@ -13,6 +13,8 @@ import qualified DDF.Map as Map import qualified DDF.VectorTF as VTF +newtype UnHOAS repr h x = UnHOAS {runUnHOAS :: repr h x}+ instance DBI repr => DBI (UnHOAS repr) where   z = UnHOAS z   s (UnHOAS x) = UnHOAS $ s x
DDF/WithDiff.hs view
@@ -17,8 +17,6 @@ selfWithDiff :: (DBI r, WithDiff r w) => r h (w -> DiffType w w) selfWithDiff = withDiff1 id -instance Lang repr => ProdCon (WithDiff repr) l r where prodCon = Sub Dict- instance Lang r => WithDiff r () where   withDiff = const1 id 
DDF/Xor.lhs view
@@ -22,6 +22,7 @@ > import DDF.Term > import DDF.ImpW > import DDF.WithDiff+> import DDF.Eval > import qualified DDF.Meta.Dual as M  Recall in poly, we constructed a function Double -> Double,
DeepDarkFantasy.cabal view
@@ -1,5 +1,5 @@ name: DeepDarkFantasy-version: 0.2017.8.7+version: 0.2017.8.8 cabal-version: 1.12 build-type: Simple license: Apache@@ -40,7 +40,6 @@     DDF.Lang     DDF.List     DDF.Map-    DDF.Meta.Interpreter     DDF.Meta.Diff     DDF.Meta.DiffWrapper     DDF.Meta.Dual@@ -73,7 +72,6 @@     containers -any,     bimap -any,     recursion-schemes -any,-    constraint-unions -any,     template-haskell -any   ghc-options: -Wall -Wno-type-defaults -Wno-missing-signatures -Wno-orphans -fwarn-tabs -ferror-spans -Wno-partial-type-signatures   if flag(WError)
test/TestPE.hs view
@@ -14,7 +14,6 @@ import Prelude ((>), (>=)) import System.Exit (exitFailure) import Control.Monad-import DDF.Meta.Interpreter import Test.QuickCheck import DDF.Eval