user5028: The homework for Week 2 involves implementing validators for two Plutus contracts. Details are here.
Spoiler alert! This probably gives away the answer to Week 2's first homework problem:
-- ...

module Week02.Homework1 where

-- ...

-- This should validate if and only if the two Booleans in the redeemer are equal!
mkValidator :: () -> (Bool, Bool) -> ScriptContext -> Bool
mkValidator _ r _ = traceIfFalse "Invalid redeemer" $ fst r == snd r

data Typed
instance Scripts.ValidatorTypes Typed where
    type instance DatumType Typed = ()
    type instance RedeemerType Typed = (Bool, Bool)

typedValidator :: Scripts.TypedValidator Typed
typedValidator = Scripts.mkTypedValidator @Typed
    $$(PlutusTx.compile [|| mkValidator ||])
    $$(PlutusTx.compile [|| wrap ||])
  where
    wrap = Scripts.wrapValidator @() @(Bool, Bool)

validator :: Validator
validator = Scripts.validatorScript typedValidator

--
-- HERE!
--
-- This appears superfluous
--
valHash :: Ledger.ValidatorHash
valHash = undefined -- FIX ME!
--valHash = Scripts.validatorHash typedValidator

scrAddress :: Ledger.Address
scrAddress = scriptAddress validator

-- ...

mkSchemaDefinitions ''GiftSchema

mkKnownCurrencies []

As marked superfluous above...
My Plutus Playground simulations execute correctly whether this line is defined or not:
valHash = undefined -- FIX ME!

This is also true of the same function definition in the second homework assignment for Week 2.

user6763: the ValidatorHash represents the hash of the serialized Script of your smart contract.
you can think at the ValidatorHash as being the equivalent of PubKeyHash used for people's wallets, but for smart contracts.
it is not needed to deploy the smart contract since the serialized Script is needed for that and not its hash.
it is instead useful to use to check if a smart contract is signing a transaction.
just like in the minting policy that allows only one wallet to mint some tokens by checking the PubKeyHash to be correct. The same logic could be applied in order to only allow a smart contract to mint, but in this case you'll need the ValidatorHash since a smart contract can't have PubKeys.
N.B.
your code compiles even if valHash is defined as
valHash = undefined

thanks to the laziness of haskell
since you never need to use the valHash in this specific example, then you never evaluate it, then there is no reason not to compile

5028: <p>The homework for Week 2 involves implementing validators for two Plutus contracts. Details are <a href="https://www.youtube.com/watch?v=_r-EpXzQGKo" rel="nofollow noreferrer">here</a>.</p>
<p><strong>Spoiler alert!</strong> This probably gives away the answer to Week 2's first homework problem:</p>
<pre><code>-- ...

module Week02.Homework1 where

-- ...

-- This should validate if and only if the two Booleans in the redeemer are equal!
mkValidator :: () -&gt; (Bool, Bool) -&gt; ScriptContext -&gt; Bool
mkValidator _ r _ = traceIfFalse &quot;Invalid redeemer&quot; $ fst r == snd r

data Typed
instance Scripts.ValidatorTypes Typed where
    type instance DatumType Typed = ()
    type instance RedeemerType Typed = (Bool, Bool)

typedValidator :: Scripts.TypedValidator Typed
typedValidator = Scripts.mkTypedValidator @Typed
    $$(PlutusTx.compile [|| mkValidator ||])
    $$(PlutusTx.compile [|| wrap ||])
  where
    wrap = Scripts.wrapValidator @() @(Bool, Bool)

validator :: Validator
validator = Scripts.validatorScript typedValidator

--
-- HERE!
--
-- This appears superfluous
--
valHash :: Ledger.ValidatorHash
valHash = undefined -- FIX ME!
--valHash = Scripts.validatorHash typedValidator

scrAddress :: Ledger.Address
scrAddress = scriptAddress validator

-- ...

mkSchemaDefinitions ''GiftSchema

mkKnownCurrencies []
</code></pre>
<p>As marked <em>superfluous</em> above...</p>
<p>My Plutus Playground simulations execute correctly whether this line is defined or not:</p>
<pre><code>valHash = undefined -- FIX ME!
</code></pre>
<p>This is also true of the same function definition in the second homework assignment for Week 2.</p>
 6763: <p>the <code>ValidatorHash</code> represents the hash of the serialized <code>Script</code> of your smart contract.</p>
<p>you can think at the <code>ValidatorHash</code> as being the equivalent of <code>PubKeyHash</code> used for people's wallets, but for smart contracts.</p>
<p>it is <strong>not</strong> needed to deploy the smart contract since the serialized <code>Script</code> is needed for that and not its hash.</p>
<p>it is instead useful to use to check if a smart contract is signing a transaction.</p>
<p>just like in the minting policy that allows only one wallet to mint some tokens by checking the <code>PubKeyHash</code> to be correct. The same logic could be applied in order to only allow a smart contract to mint, but in this case you'll need the <code>ValidatorHash</code> since a smart contract can't have <code>PubKey</code>s.</p>
<h3>N.B.</h3>
<p>your code compiles even if <code>valHash</code> is defined as</p>
<pre><code>valHash = undefined
</code></pre>
<p>thanks to the laziness of haskell</p>
<p>since you never need to use the <code>valHash</code> in this specific example, then you never evaluate it, then there is no reason not to compile</p>
