<pre><code>{-# LANGUAGE DataKinds                  #-}
{-# LANGUAGE DeriveAnyClass             #-}
{-# LANGUAGE DeriveGeneric              #-}
{-# LANGUAGE DerivingStrategies         #-}
{-# LANGUAGE FlexibleContexts           #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase                 #-}
{-# LANGUAGE MultiParamTypeClasses      #-}
{-# LANGUAGE NoImplicitPrelude          #-}
{-# LANGUAGE OverloadedStrings          #-}
{-# LANGUAGE RecordWildCards            #-}
{-# LANGUAGE ScopedTypeVariables        #-}
{-# LANGUAGE TemplateHaskell            #-}
{-# LANGUAGE TypeApplications           #-}
{-# LANGUAGE TypeFamilies               #-}
{-# LANGUAGE TypeOperators              #-}
{-# LANGUAGE BangPatterns               #-}
</code></pre>
<p>Looks like I was missing some imports that are not necessary in the playground, but are still necessary when building with cabal. Will leave this here since it may help someone else :)</p>

CC BY-SA 4.0
2021-10-26T09:23:35.123Z
2021-10-26T09:23:35.123Z
glneto
<p>I have a code that compiles and runs well in the Plutus playground, but when I try to run cabal build I get an error when calling mkTypedValidator:</p>
<pre><code>offerValidator :: Scripts.TypedValidator Offer
offerValidator = Scripts.mkTypedValidator @Offer
    $$(PlutusTx.compile [|| validateOffer ||])
    $$(PlutusTx.compile [|| wrap ||]) where
        wrap = Scripts.wrapValidator @OfferData @OfferAction
</code></pre>
<p><a href="https://i.sstatic.net/oum30.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/oum30.png" alt="parse error on input ‘]’" /></a></p>
<ul>
<li>using ghc version ghc-8.10.7</li>
<li>cabal version 3.6.0</li>
</ul>
<p>Any ideas what might be happening? Not very experienced with cabal/plutus yet.</p>
<p>Also already tried <code>cabal update</code> but looks like everything is up-to-date.</p>

<plutus><smart-contract><cabal>
Parse error on input ']' when running cabal build in my Plutus code
# Parse error on input ']' when running cabal build in my Plutus code

(Asked by: username_0 on 2021-10-26)

I have a code that compiles and runs well in the Plutus playground, but when I try to run cabal build I get an error when calling mkTypedValidator:
offerValidator :: Scripts.TypedValidator Offer
offerValidator = Scripts.mkTypedValidator @Offer
    $$(PlutusTx.compile [|| validateOffer ||])
    $$(PlutusTx.compile [|| wrap ||]) where
        wrap = Scripts.wrapValidator @OfferData @OfferAction



using ghc version ghc-8.10.7
cabal version 3.6.0

Any ideas what might be happening? Not very experienced with cabal/plutus yet.
Also already tried cabal update but looks like everything is up-to-date.

**Tags:** plutus, smart-contract, cabal

---

## 1 answers

### Answer by username_0 on 2021-10-26. Score: 2 | Accepted answer

{-# LANGUAGE DataKinds                  #-}
{-# LANGUAGE DeriveAnyClass             #-}
{-# LANGUAGE DeriveGeneric              #-}
{-# LANGUAGE DerivingStrategies         #-}
{-# LANGUAGE FlexibleContexts           #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase                 #-}
{-# LANGUAGE MultiParamTypeClasses      #-}
{-# LANGUAGE NoImplicitPrelude          #-}
{-# LANGUAGE OverloadedStrings          #-}
{-# LANGUAGE RecordWildCards            #-}
{-# LANGUAGE ScopedTypeVariables        #-}
{-# LANGUAGE TemplateHaskell            #-}
{-# LANGUAGE TypeApplications           #-}
{-# LANGUAGE TypeFamilies               #-}
{-# LANGUAGE TypeOperators              #-}
{-# LANGUAGE BangPatterns               #-}

Looks like I was missing some imports that are not necessary in the playground, but are still necessary when building with cabal. Will leave this here since it may help someone else :)


---

