mirror of
https://github.com/github/semantic.git
synced 2024-11-28 01:47:01 +03:00
Extract lens to the top level.
This commit is contained in:
parent
52bc7e640e
commit
4bc5491a25
@ -1,4 +1,4 @@
|
||||
{-# LANGUAGE DeriveGeneric, DerivingVia #-}
|
||||
{-# LANGUAGE DeriveGeneric, DerivingVia, RankNTypes #-}
|
||||
module Source.Loc
|
||||
( Loc(..)
|
||||
, Span(Span)
|
||||
@ -24,6 +24,12 @@ instance Hashable Loc
|
||||
instance NFData Loc
|
||||
|
||||
instance HasSpan Loc where
|
||||
span_ = lens span (\l s -> l { span = s }) where
|
||||
lens get put afa s = fmap (put s) (afa (get s))
|
||||
span_ = lens span (\l s -> l { span = s })
|
||||
{-# INLINE span_ #-}
|
||||
|
||||
|
||||
type Lens' s a = forall f . Functor f => (a -> f a) -> (s -> f s)
|
||||
|
||||
lens :: (s -> a) -> (s -> a -> s) -> Lens' s a
|
||||
lens get put afa s = fmap (put s) (afa (get s))
|
||||
{-# INLINE lens #-}
|
||||
|
Loading…
Reference in New Issue
Block a user