fork download
  1. {-# LANGUAGE GADTs, DataKinds, PolyKinds, KindSignatures, MultiParamTypeClasses #-}
  2.  
  3. import Data.Proxy
  4.  
  5. asIndexOf :: k s -> Proxy s -> k s
  6. asIndexOf x _ = x
  7.  
  8. data State = A | B | C
  9. data Thing (s :: State) = Thing
  10.  
  11. class Trans x y where
  12. trans :: Thing x -> Thing y
  13.  
  14. transThrough :: (Trans y z, Trans x y) => Proxy y -> Thing x -> Thing z
  15. transThrough p t = trans (trans t `asIndexOf` p)
  16.  
  17. main = return ()
Success #stdin #stdout 0s 4656KB
stdin
Standard input is empty
stdout
Standard output is empty