Created
March 2, 2015 07:51
-
-
Save rblaze/ba10cb8693a937f77ebd to your computer and use it in GitHub Desktop.
This file contains 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 ScopedTypeVariables, TypeFamilies, FlexibleContexts #-} | |
module ZZ where | |
import Data.Proxy | |
class Def a where | |
def :: a | |
class Def a => Foo a where | |
type Base a :: * | |
class (Foo a, Foo (Base a)) => Foo' a where | |
getFooBase :: Proxy a -> Maybe (Proxy (Base a)) | |
setFooBase :: a -> Base a -> a | |
setBase :: forall a. Foo' a => a | |
setBase = case getFooBase (Proxy :: Proxy a) of | |
Nothing -> def | |
Just p -> let d = setBase | |
v = setFooBase def d | |
in v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment