[Question]
  [
In Haskell the list notation:
```
[a,b,c]
```
Is just syntactic sugar for:
```
a:b:c:[]
```
And the string notation:
```
"abc"
```
Is just syntactic sugar for:
```
['a','b','c']
```
This means that the string:
```
"abc"
```
Is the same as:
```
'a':'b':'c':[]
```
# Task
Given a string you should output what the de-syntaxed version would look like in Haskell.
# Rules
* You will receive a string by any valid input method, you should output a string ending with `:[]` with every character from the input surrounded by `'` and separated by `:`. The empty string should output `[]`.
* You can assume that you will not receive any characters that require escaping (e.g. `'`, newlines, tabs ...) and that input will be in the printable ascii range
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") you should aim to minimize the byte count of your answer
## Test Cases
```
"" -> []
"a" -> 'a':[]
"Hello, World" -> 'H':'e':'l':'l':'o':',':' ':'W':'o':'r':'l':'d':[]   
```
  
[Answer]
# [Haskell](https://www.haskell.org/), 26 bytes
```
(++"[]").((++":").show=<<)
```
[Try it online!](https://tio.run/##y0gszk7NyflfrftfQ1tbKTpWSVNPA8SyAjKKM/LLbW1sNP/r1nLlJmbmKdgqZOaVpBYlJpcoqCjgUZ@YlAwA "Haskell – Try It Online") 
**Explanation:**
In non-pointfree notation and using `concatMap` instead of `=<<`, this becomes
```
f s = concatMap(\c-> show c ++ ":")s ++ "[]"
```
Given a string `s`, we map each char `c` to a string `"'c':"` using the `show` function which returns a string representation of most Haskell types. Those strings are concatenated and a final `[]` is appended.
Although not requested by the challenge, this answer even works with proper escaping, because `show` takes care of it: `f "'"` yields `"'\\'':[]"`.
[Answer]
## Haskell, ~~33~~ ~~28~~ 26 bytes
```
foldr((.(':':)).shows)"[]"
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P802LT8npUhDQ09D3UrdSlNTrzgjv7xYUyk6Vul/bmJmnoKtQko@l4JCQWlJcEmRT56CikKagpIHUHO@EoZwIqaQ0n8A "Haskell – Try It Online")
`fold` the given pointfree function from the right into the input string starting with `[]`. The function is: show char as a Haskell char, i.e. surrounded with `'` and concatenate with the result so far after putting a `:` in front of it.
Edit: @Ørjan Johansen saved two bytes. Thanks!
[Answer]
# [Python 3](https://docs.python.org/3/), 32 bytes
```
lambda s:"%r:"*len(s)%(*s,)+"[]"
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUaHYSkm1yEpJKyc1T6NYU1VDq1hHU1spOlbpf3lGZk6qgqEVl0JBUWZeiUaaRmZeQWmJhqam5n@uRC6P1JycfB2F8PyinBQA "Python 3 – Try It Online")
[Answer]
## JavaScript ES6, ~~42~~ ~~40~~ 31 bytes
```
s=>s.replace(/./g,"'$&':")+"[]"
```
Replaces each char with `'<char>':`, then adds `[]` to the end
[Try it online!](https://vihan.org/p/tio/?l=javascript-node&p=K0ssUki0VSi2tSvWK0otyElMTtXQ19NP11FSV1FTt1LS1FaKjlXi4krOzyvOz0nVy8lP10jUUPJIzcnJ11EIzy/KSVFU0tREl0/EIgYU@g8A)
[Answer]
# Common Lisp, ~~50~~ 42 bytes
```
(format t"~{'~a':~}[]"(coerce(read)'list))
```
[Try it online!](https://tio.run/##S87JLC74/18jLb8oN7FEoUSprlq9LlHdqq42OlZJIzk/tSg5VaMoNTFFUx2oskRT8/9/JY/UnJx8HYXw/KKcFCUA)
Reduced thanks to the comment of @coredump, by using `read` instead of defining a function.
[Answer]
# [V](https://github.com/DJMcMayhem/V), 11 bytes
```
Í./'&':
A[]
```
[Try it online!](https://tio.run/##K/v//3Cvnr66mroVl2N07P//iUnJKakA "V – Try It Online")
Uses a regex to surround every input character with `'':` and then `A`ppends `[]` to the end.
[Answer]
# C, ~~55~~ ~~54~~ 53 bytes
```
s(char*h){while(*h)printf("'%c':",*h++);puts("[]");}
```
[Answer]
# [Python 3](https://docs.python.org/3/), ~~41~~ ~~38~~ 36 bytes
-2 bytes thanks to ovs
```
print(*map(repr,input()),[],sep=':')
```
[Try it online!](https://tio.run/##K6gsycjPM/7/v6AoM69EQys3sUCjKLWgSCczr6C0RENTUyc6Vqc4tcBW3Upd8/9/j9ScnHwdhfD8opwUAA "Python 3 – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~15 12 11~~ 10 bytes
-3 bytes thanks to carusocomputing  
-1 byte thanks to Adnan  
-1 byte thanks to Erik the Outgolfer's genius idea
```
ʒ"'ÿ':"?},
```
[Try it online!](https://tio.run/##MzBNTDJM/V9W@f/UJCX1w/vVrZTsa3X@/49WV9dRTwRij9ScnHwdhfD8opwU9VgA "05AB1E – Try It Online")
```
ʒ          # Filter out every character that the following code doesn't return 1 for
 "'ÿ':"?   #   Print the string 'ÿ': with ÿ replaced by this character
        }  # End for
         , # No character returned 1 so an empty array is left on the stack. Print that
```
[Answer]
# R, 51 bytes
```
f<-function(x)(paste0(gsub("(.)","'\\1':",x),'[]'))
```
[Answer]
# Pyth, ~~14~~ ~~10~~ 8 bytes
```
j\:a`MQY
```
[Try this!](https://pyth.herokuapp.com/?code=j%5C%3Aa%60MQY&input=%22%22&test_suite=1&test_suite_input=%22%22%0A%22a%22%0A%22abcd%22&debug=0)
*-2 bytes thanks to @isaacg*
Finally, pyth is good at something.
### explanation
```
j\:a`MQY
    `MQ        # map the representation over the input string: ["'a'","'b'",...]
   a   Y       # append the empty list
j\:            # join on :
```
[Answer]
# Retina, 12
* 3 bytes saved thanks to @FryAmTheEggman
```
.
'$&':
$
[]
```
2 stages:
* for each remaining character put `'` `':` around it
* add `[]` to the end
[Try it online](https://tio.run/##K0otycxL/K@q4Z7wX49LXUVN3YpLhSs69v9/rkSuxKRkLo/UnJx8HYXw/KKcFAA@UU5KUoA).
[Answer]
# [Perl 6](http://perl6.org/), 19 bytes
```
{S:g|.|'$/':|~'[]'}
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~48~~ ~~46~~ ~~44~~ 37 bytes
*-2 bytes thanks to Rod. -7 bytes thanks to Wheat Wizard.*
```
lambda s:':'.join(map(repr,s)+['[]'])
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUaHYSt1KXS8rPzNPIzexQKMotaBIp1hTO1o9OlY9VvN/QVFmXolCmoa6uiYXnJ2IzPFIzcnJ11EIzy/KSVHX/A8A "Python 2 – Try It Online")
[Answer]
# [Befunge](https://github.com/catseye/Befunge-93), ~~29~~ 27 bytes
```
<,,,,\_v#`0:~"'':"
@,,"[]"<
```
[Try it online!](https://tio.run/##S0pNK81LT/3/30YHCGLiy5QTDKzqlNTVrZS4HHR0lKJjlWz@//dIzcnJVwjPL8pJUQQA "Befunge – Try It Online")
[Answer]
# JavaScript (ES6), 36 bytes
```
s=>s?`'${[...s].join`':'`}':[]`:"[]"
```
---
## Try it
```
f=
s=>s?`'${[...s].join`':'`}':[]`:"[]"
oninput=_=>o.innerText=f(i.value);o.innerText=f(i.value="abc")
```
```
<input id=i><pre id=o>
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~11 10~~ 8 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
-1 byte thanks to Christian (remove concatenation `;` and utilise implicit printing instead)
+0 bytes (fixed for edge case of an empty string - previously the full program: `ŒṘ€j”:“:[]`)
-2 thanks to Erik the Outgolfer (use `p` in place of `;€` since `”:` is effectively length 1; use `Ø[` since it has become shorthand for `⁾[]`)
```
ŒṘ€p”:Ø[
```
**[Try it online!](https://tio.run/##y0rNyan8///opIc7ZzxqWlPwqGGu1eEZ0f///1fyAErl6yiE5xflpCgqAQA "Jelly – Try It Online")**
A full program printing the result (as a link it returns a list of lists of characters).
...but is there a way to save using STDIN?
### How?
```
ŒṘ€p”:Ø[ - Main link: list of characters, s  e.g. "Hey"
ŒṘ€      - Python representation for €ach    [["'",'H',"'"],["'",'e',"'"],["'",'y',"'"]]
    ”:   - literal character = ':'
   p     - Cartesian product                 [["'",'H',"'",':'],["'",'e',"'",':'],["'",'y',"'",':']]
         - implicit print (no newline): 'H':'e':'y':
      Ø[ - literal list of characters        ['[',']']
         - implicit print (no newline): []
```
[Answer]
# [PHP](https://php.net/), 41 bytes
```
<?=preg_filter("#.#","'$0':",$argn)."[]";
```
[Try it online!](https://tio.run/##K8go@G9jX5BRwJVaVJRfFF@UWpBfVJKZl65R5xrv5x/i6eyqac2lkliUnmer5JGak5OvoxCeX5STomTNZW8H1GpbUJSaHp@WmVOSWqShpKynrKSjpK5ioG6lpAPWpamnFB2rZP3//9e8fN3kxOSMVAA "PHP – Try It Online")
[Answer]
# [Perl 5](https://www.perl.org/), 22 bytes
19 bytes of code + `-p` flag.
```
s/./'$&':/g;$\="[]"
```
Or, for the same bytecount, `s/./'$&':/g;s/$/[]/`.
Quite straight forward: `s/./'$&':/g` surrounds each characters with quotes and add a `:` after. `$\` is implicitly printed after each print, so setting it to `[]` outputs the final `[]`.
[Try it online!](https://tio.run/##K0gtyjH9r6xYAKQVdAv@F@vr6aurqKlb6adbq8TYKkXHKv3/75Gak5OvoxCeX5STAgA "Perl 5 – Try It Online")
[Answer]
# [Java (OpenJDK 8)](http://openjdk.java.net/), ~~86~~ ~~83~~ 76 bytes
*-3 bytes thanks to @KevinCruijssen*  
*-7 bytes thanks to @FlorianSchaetz* 
```
s->{String b="";for(char c:s.toCharArray()){b+="'"+c+"':";};return b+"[]";};
```
[Try it online!](https://tio.run/##hY0xb4MwEIXn8CtOXmKLxD8glEhVpapLpwwdogyHgcTUsS37iIQQv506hT1vee/efbrr8IF75xvb1b@z7yujFSiDMcI3agtjBklrHwkp2cPpGu5py08UtL2eL4DhGkWCN106J3vSRra9VaSdlZ9reFvoHSx@hBZKmOP@OC4FVCVjResCVzcMoA5RkvtI8T0EHLgQY5WXbMtylbPtgRVTERrqg4UqZ@fLc55hVZFtTkOk5i5dT9Kn62QsbyV6bwbOmBAvCHyNfDXGuB38uGDqf/r5eMqm@Q8 "Java (OpenJDK 8) – Try It Online")
[Answer]
# brainfuck, 68 bytes
```
+[-->+[<]>-]>>,[<.>.<.>>-[>+<+++++++++]>+.[-]<<,]-[+[+<]>>+]<+++.++.
```
[Try it online!](https://tio.run/##NYo7CoBADESvovVscoIwtTewCCn8gri4IHj@dS0c3qvezPd0XPuznLXCRQi3oASZ3JTapDhh@BeEuoRZCnE42p2Ir2uj1mHLuaRuLHde@xc "brainfuck – Try It Online")
[Answer]
# [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak), ~~135~~, 131 bytes
```
{({}<>)<>}(((((((()()()()()){})){}{}())){}{})[()()])<>{<>(((((((()()()){}()){}){}()){})[(((()()()){})){}{}()])<>)({}<({}<>)>)<>}<>
```
[Try it online!](https://tio.run/##SypKzMzTTctJzP7/v1qjutbGTtPGrlYDCjRhULO6FoSra4FMMK0ZDRKOBSqutrFDUa4JVgRUAaOjkaVgpoB0aoLsg9gJttXG7v9/J4R7dJMB "Brain-Flak – Try It Online")
`+1` byte for the `-c` flag.
Thanks to WheatWizard for removing very obvious NOOPs that I had for no reason XD.
[Answer]
# [Standard ML](http://www.mlton.org/), ~~52~~ 50 bytes
Saved 2 bytes thanks to @Laikoni!
```
fn s=>String.translate(fn c=>"'"^str c^"':")s^"[]"
```
[Try it online!](https://tio.run/##DcpBCoMwEAXQq3xnkwjWA1TiunuXpYGgiQhjUjJDPX7q9vHk5MfJWnL7BUaCQ0sZ4uZF65H3UWvIwkGjvXl1MxnyohWrJ/OkXjy9P9QmfO@tsAn0isxlwFUqbx31U/sD "Standard ML (MLton) – Try It Online")
`String.translate` is an unfortunately long name, but was 5 bytes shorter than using `concat`, `map`, and `explode`.
[Answer]
# [Cubix](https://github.com/ETHproductions/cubix), ~~31~~ 29 bytes
```
uo@[)o'U);!A?ro;o;o;os:'/u:''
```
`A` can also be substituted for `i`; ~~trying to figure out if there's a good way to squeeze another byte or two out of this.~~ -2 bytes thanks to MickyT! Also [outgolfed by MickyT](https://codegolf.stackexchange.com/a/126778/67312)!
Fits on a 3x3x3 cube:
```
      u o @
      [ ) o
      ' U )
; ! A ? r o ; o ; o ; o
s : ' / u : ' ' . . . .
. . . . . . . . . . . .
      . . .
      . . .
      . . .
```
[Watch it online!](http://ethproductions.github.io/cubix/?code=ICAgICAgdSBvIEAKICAgICAgWyApIG8KICAgICAgJyBVICkKOyAhIEEgPyByIG8gOyBvIDsgbyA7IG8KcyA6ICcgLyB1IDogJyAnIC4gLiAuIC4KLiAuIC4gLiAuIC4gLiAuIC4gLiAuIC4KICAgICAgLiAuIC4KICAgICAgLiAuIC4KICAgICAgLiAuIC4K&input=YWJj&speed=10)
[Try it online!](https://tio.run/##Sy5Nyqz4/7803yFaM189VNNa0dG@KN8aDIut1PVLrdTV//9PTEoGAA "Cubix – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), 47 bytes
```
lambda a:`list(a)+[[]]`.replace(', ',':')[1:-1]
```
[Try it online!](https://tio.run/##DcNBCoQgFADQfaf4uFEZJ3CWwuznBi1M6DcZCX9UzIg5vfXg5X/dUny19T02wt@8IKCZKOxVoHxY69zUF58Jv15wBVxxw6XV5qldO7dAHrTpIJcQK6wixHxUIWVjrGN4/3iipGBIhRZ2AQ "Python 2 – Try It Online")
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), ~~21~~ 19 bytes
```
'[]',⍨'.'⎕R'''&'':'
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///v/hR2wT16Fh1nUe9K9T11B/1TQ1SV1dXU1e3UgdKKqircwGJRDDpkZqTk6@jEJ5flJOiDgA "APL (Dyalog Unicode) – Try It Online")
`'[]',⍨` the brackets appended to
`'.'` every character
`⎕R` PCRE **R**eplaced with
`'''&'':'` a quote, the match, a quote and a colon
[Answer]
# [sed](https://www.gnu.org/software/sed/), ~~19~~ 18 bytes
-1 byte thanks to [Jordan](https://codegolf.stackexchange.com/users/11261/jordan)
```
s/./'&':/g;s/$/[]/
```
[Try it online!](https://tio.run/##K05N@f@/WF9PX11N3Uo/3bpYX0U/Olb///@M1JycfAA "sed – Try It Online")
[Answer]
# PHP, 39 bytes
```
<?while(~$c=$argn[$i++])echo"'$c':"?>[]
```
Run as pipe with `-F`.
[Answer]
# [Convex](https://github.com/GamrCorps/Convex), 10 bytes
```
{`':`}%"[]
```
[Try it online!](https://tio.run/##S87PK0ut@P@/OkHdKqFWVSk69v9/j9ScnHwdhfD8opwUAA "Convex – Try It Online")
[Answer]
# [Cubix](https://github.com/ETHproductions/cubix), 27 bytes
```
uosW?U.iv":'"^soso;os@o[]'/
```
[Try it online!](https://tio.run/##Sy5Nyqz4/780vzjcPlQvs0zJSl0prji/ON86v9ghPzpWXf///5LU4hKukozMYgA "Cubix – Try It Online")
```
      u o s
      W ? U
      . i v
" : ' " ^ s o s o ; o s
@ o [ ] ' / . . . . . .
. . . . . . . . . . . .
      . . .
      . . .
      . . .
```
[Watch it run](https://ethproductions.github.io/cubix/?code=ICAgICAgdSBvIHMKICAgICAgVyA/IFUKICAgICAgLiBpIHYKIiA6ICcgIiBeIHMgbyBzIG8gOyBvIHMKQCBvIFsgXSAnIC8gLiAuIC4gLiAuIC4KLiAuIC4gLiAuIC4gLiAuIC4gLiAuIC4KICAgICAgLiAuIC4KICAgICAgLiAuIC4KICAgICAgLiAuIC4K&input=dGVzdAoxLi4yLi4z&speed=15)
A slightly different variation from Guiseppe's [answer](https://codegolf.stackexchange.com/a/126620/31347). This puts the colon and quote on the stack. Then it loops through the input, swapping and outputting the stack. Only the input is scrapped and the colon and quote are retained.
Once the end of the input is reached the IP wonders around the cube a bit, adding and outputting the brackets. There are a couple of redundant commands in the mix.
]