Combine sugar, flour, and salt in a heavy saucepan. Mix well to remove lumps. Add chocolate; stir well. Gradually add milk, stirring constantly, to prevent lumps from forming. Add water and egg yolks; stir well.
Cook over low heat 15 minutes or until thickened, stirring frequently. Remove from heat, and stir in marshmallows and butter. Cool slightly. Pour filling into piecrust. Chill 4 hours or until firm. Garnish with whipped cream and pecans, if desired.