Commit 41b63f8f authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Add a prism for ValidOpCode



...to be able to operate on the MetaOpCode that
is behind an InputOpCode (if we're in the right
component of the sum).
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent c3bea705
......@@ -27,8 +27,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
module Ganeti.JQueue.Lens where
import Control.Lens.Prism (Prism', prism')
import Ganeti.JQueue.Objects
import Ganeti.Lens (makeCustomLenses)
import Ganeti.OpCodes (MetaOpCode)
validOpCodeL :: Prism' InputOpCode MetaOpCode
validOpCodeL = prism' ValidOpCode $ \op ->
case op of
ValidOpCode mop -> Just mop
_ -> Nothing
$(makeCustomLenses ''QueuedOpCode)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment