A modder named xxdeathknight77xx on Nexus has found the harpoon gun which was buried in Fallout 4's list, likely after Bethesda decided that it didn't fit within their plans. You can watch YouTuber Tyrannicon above take the harpoon gun through its paces above.
The harpoon gun effectively replaces the railway rifle in the game and actually functions as it would expect it to, including standard fire and animations in VATS. It requires special ammo, though, so you will need to use the console command "player.additem 000fe269 50" to add the harpoon gun's ammo to your inventory.
The animation for the gun comes with bubbles attached to it, so the gun was likely part of some underwater level, perhaps as a way to pierce the shell of mirelurks.