Evgenii Akentev
·
2021-09-08
HandleRow.hs
1{-# LANGUAGE TypeApplications #-}
2{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE RankNTypes #-}
4{-# LANGUAGE ScopedTypeVariables #-}
5{-# LANGUAGE FlexibleContexts #-}
6{-# LANGUAGE GADTs #-}
7{-# LANGUAGE AllowAmbiguousTypes #-}
8{-# LANGUAGE TypeOperators #-}
9
10module HandleRow where
11
12import Data.Row
13
14type HandleRow rs = Rec rs
15
16getMethod :: forall l r . KnownSymbol l => Rec r -> r .! l
17getMethod = flip (.!) (Label @l)