Created
August 17, 2014 21:25
-
-
Save Shimuuar/db3dbe64a07466e26f83 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE KindSignatures #-} | |
module TySet where | |
import Data.Typeable | |
import GHC.TypeLits | |
class UpdateCompose (k :: Nat) (v :: Nat) where | |
update :: Proxy k -> Proxy v -> [Double] -> [Double] | |
instance UpdateComposeCase (k <=? v) k v => UpdateCompose k v where | |
update = updateCase (Proxy :: Proxy (k <=? v)) | |
class UpdateComposeCase (leq :: Bool) (k :: Nat) (v::Nat) where | |
updateCase :: Proxy leq -> Proxy k -> Proxy v -> [Double] -> [Double] | |
instance UpdateComposeCase True k v where | |
updateCase _ _ _ = id | |
instance UpdateComposeCase False k v where | |
updateCase _ _ _ = error "Something meaningful" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment