dpkg -l lists all installed system packages.
grep libghc filters out all haskell packages
grep "\-dev" filters out the actual source packages, where -dev can be replaced with -prof to get the name of the profiling package
cut -d " " -f 3 converts lines from
ii libghc-packagename-dev 0.1.3.3-7 amd64 description
tr '\n' ' ' Replaces newlines with spaces, merging it all into one line
sed -e 's/\-dev/\-prof/g' Replaces
xargs sudo apt-get install --yes Passes the string (now looking like
libghc-a-prof libghc-b-prof libghc-c-prof) as arguments to
sudo apt-get install --yes which installs all package names it receives as arguments, and does not ask for confirmation.