Skip to content

Instantly share code, notes, and snippets.

@o1lo01ol1o
Created January 13, 2017 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save o1lo01ol1o/8319c986b27fcf0d06fbc89552e0760a to your computer and use it in GitHub Desktop.
Save o1lo01ol1o/8319c986b27fcf0d06fbc89552e0760a to your computer and use it in GitHub Desktop.
failure of liberal coverage condition
{-# LANGUAGE DataKinds, PolyKinds, ScopedTypeVariables,
FlexibleInstances, FlexibleContexts, GADTs, TypeFamilies,
RankNTypes, LambdaCase, TypeOperators, TemplateHaskell,
ConstraintKinds, PolyKinds, NoImplicitPrelude,
UndecidableInstances, MultiParamTypeClasses ,
GADTSyntax,
AllowAmbiguousTypes,
InstanceSigs,
DeriveFunctor,
FunctionalDependencies#-}
class (ValidBroadCast s t ~ True, u ~ EvalBroadcast s t) =>
BroadCastAlgebra s t u | s t -> u where
(+) :: (Tensor s fv a) -> (Tensor t fv a) -> (Tensor u fv a)
instance BroadCastAlgebra s t u where
(+) :: (Tensor s fv a) -> (Tensor t fv a) -> (Tensor u fv a)
(+) (Tensor a) (Tensor b) = Tensor $ TF.add a b
@glguy
Copy link

glguy commented Jan 18, 2017

class ValidBroadCast s t ~ True => BroadCastAlgebra s t where
        (+) :: (Tensor s fv a) -> (Tensor t fv a) -> (Tensor (EvalBroadcast s t) fv a)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment