user4960: Example:
testTxOut :: IO ()
testTxOut = do
  let
    testInput = "addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n + 1000000 lovelace"
  case (OutBuilder.getTxOutFrom testInput) of
     Left err -> putStrLn $ show err
     Right tx -> putStrLn $ "passed" -- HOW TO SHOW IT HERE

almost from the Cardano.CLI.Shelley.Parsers because it does not export one
module BuildTxOut
  (getTxOutFrom)
where

import Cardano.Api
import Cardano.CLI.Types
import Cardano.CLI.Shelley.Parsers

import qualified Text.Parsec as Parsec

import qualified Text.Parsec.Language as Parsec
import qualified Text.Parsec.String as Parsec
import qualified Text.Parsec.Token as Parsec


parseTxOutAnyEra2 :: Parsec.Parser (TxOutDatumAnyEra -> TxOutAnyEra)
parseTxOutAnyEra2 = do
    addr <- parseAddressAny
    Parsec.spaces
    -- Accept the old style of separating the address and value in a
    -- transaction output:
    Parsec.option () (Parsec.char '+' >> Parsec.spaces)
    val <- parseValue
    return (TxOutAnyEra addr val)

getTxOutFrom :: String -> Either Parsec.ParseError (TxOutDatumAnyEra -> TxOutAnyEra )
getTxOutFrom s = Parsec.parse parseTxOutAnyEra2 "Wrong" s


user4960: Here is simplified version got from cardano-cli Parsers that works.
module BuildTxOut
where

import Cardano.Api
import Cardano.CLI.Types
import Cardano.CLI.Shelley.Parsers

import qualified Text.Parsec as Parsec

import qualified Text.Parsec.Language as Parsec
import qualified Text.Parsec.String as Parsec
import qualified Text.Parsec.Token as Parsec


parseTxOutAnyEra2 :: Parsec.Parser (TxOutDatumAnyEra -> TxOutAnyEra)
parseTxOutAnyEra2 = do
    addr <- parseAddressAny
    Parsec.spaces
    -- Accept the old style of separating the address and value in a
    -- transaction output:
    Parsec.option () (Parsec.char '+' >> Parsec.spaces)
    val <- parseValue
    return (TxOutAnyEra addr val)

pTxOut ::  Parsec.Parser TxOutAnyEra
pTxOut = parseTxOutAnyEra2 <*> pTxOutDatum


-- INFO: can be modified to accept all functionality
-- see original implementation

pTxOutDatum ::  Parsec.Parser TxOutDatumAnyEra
pTxOutDatum = pure TxOutDatumByNone

getTxOut :: String -> Either Parsec.ParseError TxOutAnyEra
getTxOut s = Parsec.parse pTxOut "Wrong" s


4960: <p>Example:</p>
<pre><code>testTxOut :: IO ()
testTxOut = do
  let
    testInput = &quot;addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n + 1000000 lovelace&quot;
  case (OutBuilder.getTxOutFrom testInput) of
     Left err -&gt; putStrLn $ show err
     Right tx -&gt; putStrLn $ &quot;passed&quot; -- HOW TO SHOW IT HERE
</code></pre>
<p>almost from the Cardano.CLI.Shelley.Parsers because it does not export one</p>
<pre><code>module BuildTxOut
  (getTxOutFrom)
where

import Cardano.Api
import Cardano.CLI.Types
import Cardano.CLI.Shelley.Parsers

import qualified Text.Parsec as Parsec

import qualified Text.Parsec.Language as Parsec
import qualified Text.Parsec.String as Parsec
import qualified Text.Parsec.Token as Parsec


parseTxOutAnyEra2 :: Parsec.Parser (TxOutDatumAnyEra -&gt; TxOutAnyEra)
parseTxOutAnyEra2 = do
    addr &lt;- parseAddressAny
    Parsec.spaces
    -- Accept the old style of separating the address and value in a
    -- transaction output:
    Parsec.option () (Parsec.char '+' &gt;&gt; Parsec.spaces)
    val &lt;- parseValue
    return (TxOutAnyEra addr val)

getTxOutFrom :: String -&gt; Either Parsec.ParseError (TxOutDatumAnyEra -&gt; TxOutAnyEra )
getTxOutFrom s = Parsec.parse parseTxOutAnyEra2 &quot;Wrong&quot; s
</code></pre>
 4960: <p>Here is simplified version got from cardano-cli Parsers that works.</p>
<pre><code>module BuildTxOut
where

import Cardano.Api
import Cardano.CLI.Types
import Cardano.CLI.Shelley.Parsers

import qualified Text.Parsec as Parsec

import qualified Text.Parsec.Language as Parsec
import qualified Text.Parsec.String as Parsec
import qualified Text.Parsec.Token as Parsec


parseTxOutAnyEra2 :: Parsec.Parser (TxOutDatumAnyEra -&gt; TxOutAnyEra)
parseTxOutAnyEra2 = do
    addr &lt;- parseAddressAny
    Parsec.spaces
    -- Accept the old style of separating the address and value in a
    -- transaction output:
    Parsec.option () (Parsec.char '+' &gt;&gt; Parsec.spaces)
    val &lt;- parseValue
    return (TxOutAnyEra addr val)

pTxOut ::  Parsec.Parser TxOutAnyEra
pTxOut = parseTxOutAnyEra2 &lt;*&gt; pTxOutDatum


-- INFO: can be modified to accept all functionality
-- see original implementation

pTxOutDatum ::  Parsec.Parser TxOutDatumAnyEra
pTxOutDatum = pure TxOutDatumByNone

getTxOut :: String -&gt; Either Parsec.ParseError TxOutAnyEra
getTxOut s = Parsec.parse pTxOut &quot;Wrong&quot; s
</code></pre>
