Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- atIdx ::
- forall fname a arrlen. (
- HasField fname a,
- IsFieldArray fname a 'True,
- arrlen ~ FieldArrayLength fname a,
- KnownNat arrlen
- ) =>
- Integer ->
- (forall idx. CanReadFieldArray fname idx a => Proxy.Proxy idx -> FieldType fname a) ->
- Maybe (FieldType fname a)
- atIdx i f =
- case someNatVal i of
- Just (SomeNat iproxy) ->
- case cmpNat iproxy (Proxy.Proxy :: Proxy.Proxy arrlen) of
- CLT Refl -> Just (f iproxy)
- _ -> Nothing
- Nothing -> Nothing
- {-
- src/Main.hs:685:27-34: error:
- • Overlapping instances for CanReadFieldArray fname n a
- arising from a use of ‘f’
- Matching instances:
- instance [overlappable] (HasField fname a,
- IsFieldArray fname a 'True, IndexInBounds fname idx a,
- (TypeError ...)) =>
- CanReadFieldArray fname idx a
- -- Defined in ‘Graphics.Vulkan.Marshal’
- instance [overlapping] (KnownNat idx,
- IndexInBounds "float32" idx VkClearColorValue) =>
- CanReadFieldArray "float32" idx VkClearColorValue
- -- Defined in ‘vulkan-api-1.1.3.0:Graphics.Vulkan.Types.Struct.Clear’
- instance [overlapping] (KnownNat idx,
- IndexInBounds "int32" idx VkClearColorValue) =>
- CanReadFieldArray "int32" idx VkClearColorValue
- -- Defined in ‘vulkan-api-1.1.3.0:Graphics.Vulkan.Types.Struct.Clear’
- ...plus 25 others
- ...plus one instance involving out-of-scope types
- (use -fprint-potential-instances to see them all)
- (The choice depends on the instantiation of ‘fname, n, a’
- To pick the first instance above, use IncoherentInstances
- when compiling the other instance declarations)
- • In the first argument of ‘Just’, namely ‘(f iproxy)’
- In the expression: Just (f iproxy)
- In a case alternative: CLT Refl -> Just (f iproxy)
- |
- 685 | CLT Refl -> Just (f iproxy)
- | ^^^^^^^^
- -}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement