user2009: I am currently working on Lecture 8 in the Plutus Pioneer program.
I want to view funds available at a script address.
There appears to be a function that makes this easy in Ledger.AddressMap
-- | Get the funds available at a particular address.
fundsAt :: Address -> Lens' AddressMap UtxoMap
fundsAt addr = at addr . non mempty

However, I have not been able to get this to work.
When I try this
fundsAt scriptAddress

I get the following error
Ambiguous type variable ‘f0’ arising from a use of ‘fundsAt’
  prevents the constraint ‘(Prelude.Functor f0)’ from being solved.

My attempts at trying to make the type unambiguous have not worked, and I am struggling to understand Lens'.
Does anyone know how to get the fundsAt function to work?

user1130: If you are trying to do this in your offchain code, I would suggest using Plutus.Contract.utxoAt instead.
Here is an example of it being used in the gift code.

2009: <p>I am currently working on Lecture 8 in the Plutus Pioneer program.</p>
<p>I want to view funds available at a script address.</p>
<p>There appears to be a function that makes this easy in <a href="https://github.com/input-output-hk/plutus/blob/master/plutus-ledger/src/Ledger/AddressMap.hs#L96-L98" rel="nofollow noreferrer">Ledger.AddressMap</a></p>
<pre><code>-- | Get the funds available at a particular address.
fundsAt :: Address -&gt; Lens' AddressMap UtxoMap
fundsAt addr = at addr . non mempty
</code></pre>
<p>However, I have not been able to get this to work.</p>
<p>When I try this</p>
<pre><code>fundsAt scriptAddress
</code></pre>
<p>I get the following error</p>
<pre><code>Ambiguous type variable ‘f0’ arising from a use of ‘fundsAt’
  prevents the constraint ‘(Prelude.Functor f0)’ from being solved.
</code></pre>
<p>My attempts at trying to make the type unambiguous have not worked, and I am struggling to understand <code>Lens'</code>.</p>
<p>Does anyone know how to get the <code>fundsAt</code> function to work?</p>
 1130: <p>If you are trying to do this in your offchain code, I would suggest using <a href="https://alpha.marlowe.iohkdev.io/doc/haddock/plutus-contract/html/Plutus-Contract.html#v:utxoAt" rel="nofollow noreferrer"><code>Plutus.Contract.utxoAt</code></a> instead.</p>
<p><a href="https://github.com/input-output-hk/plutus-pioneer-program/blob/main/code/week02/src/Week02/Gift.hs#L58" rel="nofollow noreferrer">Here</a> is an example of it being used in the gift code.</p>
