Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Assuming you just want the default style, simply adding <code>deriving Show</code> to the end of the line as below should do the job.</p> <pre><code>data Blabla = Blabla [Integer] [Char] [(Integer,Char,Char,Integer,String)] Integer deriving Show </code></pre> <p>Will work fine as all of the primitive types that Blabla is built from are "showable". For example</p> <pre><code>*Main&gt; Blabla [1,2,3] "abc" [(1,'A','B',2,"Three")] 54 Blabla [1,2,3] "abc" [(1,'A','B',2,"Three")] 54 </code></pre> <p>It might be better to build <code>Blabla</code> as a named structure</p> <pre><code> data BlaBlu = BlaBlu { theNumbers :: [Integer] , theIdentifier :: [Char] , theList :: [(Integer,Char,Char,Integer,String)] , theInteger :: Integer } deriving Show </code></pre> <p>By doing this you might be able to make the structure make more sense.</p> <pre><code>*Main&gt; BlaBlu [1,2,3] "abc" [(1,'A','B',2,"Three")] 54 BlaBlu {theNumbers = [1,2,3], theIdentifier = "abc", theList = [(1,'A','B',2,"Three")], theInteger = 54} </code></pre> <p>Do the same thing for the list structure and hopefully the code will be more readable.</p> <p>If you want to write your own instance of <code>Show</code> so you can customize it then you can remove the <code>deriving Show</code> and just write your own instance, such as:</p> <pre><code>instance Show Blabla where show (Blabla ints chars list num) = "integers = " ++ show ints ++ "\n" ++ "chars = " ++ show chars ++ "\n" ++ "specialList = " ++ show list ++ "\n" ++ "integer = " ++ show num </code></pre> <p>Where the implementation produces roughly the output you asked in the original question.</p> <pre><code>*Main&gt; Blabla [1,2,3] "abc" [(1,'A','B',2,"Three")] 54 integers = [1,2,3] chars = "abc" specialList = [(1,'A','B',2,"Three")] integer = 54 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload