hsclass IsLabel (x :: Symbol) a where
fromLabel :: a
hsinstance IsLabel "hoge" (Hoge -> Int) where
fromLabel Hoge { hoge } = hoge
hs{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
import GHC.OverloadedLabels (IsLabel (fromLabel))
import GHC.Records (HasField (getField))
instance HasField x r a => IsLabel x (r -> a) where
fromLabel = getField @x