{-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeOperators #-} module A where import Data.Extensible import Data.Functor.Identity import Data.String import Data.Text type T = Record Fields type Fields = '[ "a" >: Text , "b" >: Text , "c" >: Text ] r :: T r = htabulateFor (Proxy @(TargetIs IsString)) $ wrap . f . getMemberId f :: IsString p => Int -> p f 0 = "One" f 1 = "Two" f 2 = "Three"
λ r a @= "One" <: b @= "Two" <: c @= "Three" <: nil
- error: {lhs: Field (Identity x), rhs: wrap x}
extensible攻略Wiki
RankNTypes と型レベルリストと extensible
Last updated 5 years ago